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.
Hello community,
I have 3 measures from which I only want to show the top 3 values and the bottom 3 values in the same column for the respective measure.
S-ratio = MAX(DataUnpivot[Solvabiliteits-ratio]) Debt/EBITDA = MAX(DataUnpivot[Debt/EBITDA-ratio]) DSCR = MAX(DataUnpivot[DSCR column])
Could you explain me whether to use TOPN or RANKX and if possible send me some code I could realise this.
Your help is much appreciated
Solved! Go to Solution.
Hi @Luukvv93
To receive below result.
You can modify below DAX expression.
Rank Top and Bottom Three Sales by Brand =
VAR __grain =
CALCULATETABLE (
VALUES ( 'Product'[Brand] ),
--Rank by Column
ALLSELECTED ()
) -- replace [Sales] with your Measure
VAR __top =
RANKX ( __grain, [Sales],, DESC ) <= 3
VAR __bottom =
RANKX ( __grain, [Sales],, ASC ) <= 3
RETURN
SWITCH ( TRUE (), __top, [Sales], __bottom, [Sales] )
Hi @Luukvv93
To receive below result.
You can modify below DAX expression.
Rank Top and Bottom Three Sales by Brand =
VAR __grain =
CALCULATETABLE (
VALUES ( 'Product'[Brand] ),
--Rank by Column
ALLSELECTED ()
) -- replace [Sales] with your Measure
VAR __top =
RANKX ( __grain, [Sales],, DESC ) <= 3
VAR __bottom =
RANKX ( __grain, [Sales],, ASC ) <= 3
RETURN
SWITCH ( TRUE (), __top, [Sales], __bottom, [Sales] )
Hi @Mariusz
I tried your solution and it seems to work, great.
One question regarding the bottom 3 values:
The measure only shows the top 3 ranks (as expected) but only the 2 bottom ranks.
Any clue on how to show the 3 bottom ranks?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
94 | |
77 | |
65 | |
53 |
User | Count |
---|---|
145 | |
105 | |
104 | |
90 | |
63 |