Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BigPatJennings
Frequent Visitor

Filtering a table to show selected value and x items above and below it

Hi,

I have a list of ranked items in a table. I'd like to display only the selected value of the table from a filter, plus the two items above it and the two items below in rank order. So, for example, if I choose an item with a 36 rank, the table I want to display would show only items 34, 35, 36, 37 and 38. I'm not sure how to do this. 

I've attached a sample pbix here https://drive.google.com/file/d/1fM3bhbxQ8Sr21ZBnrY3hQ_10VHg_IL5_/view?usp=sharing that has 50 items

Many thanks

1 ACCEPTED SOLUTION
v-binbinyu-msft
Community Support
Community Support

Hi @BigPatJennings ,

Please try to add a card visual with below dax formula

Measure =
VAR cur_team =
    SELECTEDVALUE ( TblRank[Team] )
VAR cur_rk =
    CALCULATE ( MAX ( TblRank[Rk] ), TblRank[Team] = cur_team, ALL ( TblRank ) )
VAR tmp =
    FILTER (
        ALL ( TblRank ),
        TblRank[Rk] >= cur_rk - 2
            && TblRank[Rk] <= cur_rk + 2
    )
RETURN
    CONCATENATEX ( tmp, [Rk] & ":" & [Team], "
" )

Animation12.gif

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

View solution in original post

2 REPLIES 2
v-binbinyu-msft
Community Support
Community Support

Hi @BigPatJennings ,

Please try to add a card visual with below dax formula

Measure =
VAR cur_team =
    SELECTEDVALUE ( TblRank[Team] )
VAR cur_rk =
    CALCULATE ( MAX ( TblRank[Rk] ), TblRank[Team] = cur_team, ALL ( TblRank ) )
VAR tmp =
    FILTER (
        ALL ( TblRank ),
        TblRank[Rk] >= cur_rk - 2
            && TblRank[Rk] <= cur_rk + 2
    )
RETURN
    CONCATENATEX ( tmp, [Rk] & ":" & [Team], "
" )

Animation12.gif

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

Ah, I didn't think of using a card, that's excellent. Thank you very much.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors