cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors