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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.