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
LucaixBolha
Resolver I
Resolver I

How to do sequential filtering for rankings

Hi guys! 

 

I have a dimension table of Assets, and I'm doing a three-step ranking filtering, being that after each rank filter the number of assets analyzed is restrained.

 

I created independent slicers for each ranking (Market Value, Volatility and "P/BV", known as Price/Book-to-Value), but when I apply the third ranking it filters the Assets of the first rank's selection (Mkt Value):

LucaixBolha_1-1660938048013.png

I would like to restrain the Assets range to the codes in the volatility ranking (AESB3, ABCB4 and TTEN3), and then apply the P/BV rank. The expected result would be this:

LucaixBolha_2-1660938312753.png

This is the link to the example pbix: https://drive.google.com/file/d/1N_g1fl5zkXibp6vNwy9s_oBifJCiGu0n/view?usp=sharing

 

Could anyone give me an advice on this problem please? 

Thanks!

 

6 REPLIES 6
LucaixBolha
Resolver I
Resolver I

Didn't manage yet to do it 😬, anyone willing to help? 😅

lbendlin
Super User
Super User

 

TopN 3 P/BV = 

VAR SelectedTop = SELECTEDVALUE('TOPN 3'[Top N 3])

RETURN
CALCULATE(
SWITCH(
    TRUE(),
    SelectedTop = 0, 
    [_Rank Switch P/BV],
    
    [_Rank Switch P/BV] <= SelectedTop,
    [_Rank Switch P/BV]
),

 

SelectedTop will never be zero. You would need to use the standard measure trick

 

VAR SelectedTop = 0+SELECTEDVALUE('TOPN 3'[Top N 3])

 

Adjust your other measures accordingly.  Note:  You may need to compute your TOPN dynamically because the TOP N 3 filter should only allow you to select whatever has been prefiltered in Top N 2.  (In your example Top N 3 should only allow you to select from 1 to 3 items, no?) 

@lbendlin, could you please talk a little bit more about the standard measure trick (what is it for, etc.)?

 

If there is a threat that a measure could return BLANK()  you can add a 0 to the measure output to return at least "something"  without skewing the final result. 

ahhh got it! Thanks a lot 😄

Ahh you're right @lbendlin!

 

Indeed, Var SelectedTop won't be zero and TOP N 3 filter should only allow me to select whatever has been prefiltered in Top N 2. Thank you very much for your time, I'll try it out! 🙏🙌

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