Forum Discussion
Calcualting Top 5 Customers
- Anonymous4 years ago
Hi MohanV ,
I updated your sample pbix file(see attachment), please check if that is what you want.
1. Create a measure as below to judge if a customer is in the top five of the sales ranking
Flag = VAR _rank = RANKX ( ALLEXCEPT ( 'Table', 'Table'[Tier1/2] ), CALCULATE ( SUM ( 'Table'[Sales] ) ), , DESC, DENSE ) RETURN IF ( _rank <= 5, 1, 0 )2. Apply the visual level filter with the condition on the area chart
Best Regards
MohanV , You can try TOPN
example
CALCULATE([measure],TOPN(10,allselected(Customer[Customer]),[measure],DESC),VALUES(Customer[Customer]))
It should give top 5 inside each tier if that is used in visual
else refer
https://www.sqlbi.com/articles/filtering-the-top-3-products-for-each-category-in-power-bi/
amitchandak thanks for your quick responce.
I tried this in my file.
But seems like its not working.
As i have selected, C1, C2, C3 from tier1, and Tier2 completely...
It should give me the Tier1 values first and then top2 from Tier2 as i already selected 3 customers from tier1
Please suggest
- Anonymous4 years agoNot applicable
Hi MohanV ,
I updated your sample pbix file(see attachment), please check if that is what you want.
1. Create a measure as below to judge if a customer is in the top five of the sales ranking
Flag = VAR _rank = RANKX ( ALLEXCEPT ( 'Table', 'Table'[Tier1/2] ), CALCULATE ( SUM ( 'Table'[Sales] ) ), , DESC, DENSE ) RETURN IF ( _rank <= 5, 1, 0 )2. Apply the visual level filter with the condition on the area chart
Best Regards