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.
Hi, I have ranked my suppliers by sales with this RANKX function:
Solved! Go to Solution.
I have done something similar in my own workbook, and I have used these two measures:
Rank sales= VAR __items = CALCULATE( COUNTROWS( Sales); FILTER( ALL( FactSales[Sales]); NOT( ISBLANK( [Sales (total)])) ) ) RETURN IF( RANKX( ALL(FactSales); [Sales (total)] ) > __items; BLANK(); RANKX( ALL(FactSales); [Sales (total)] ) )
title sales(top 1) = CALCULATE( VALUES( FactSales[Sales]); FILTER( FactSales; [Rank sales] = 1 ) )
If it works then please mark it as the accepted solution.
Sorry - I have changed my code slightly and I have made some translation errors... It is not the FactSales table but the DimSalesItem table which I count and [Sales (total)] return the sum of sales from the FactTable.
The countrows return the number of items where there is a sale. This is done to ensure that only items with a sale get a rank, but this is probably not necessary in your case.
The measures should therefore be (without the blank part):
RANKX( ALL(DimSalesItem); [Sales (total)] )
title sales(top 1) = CALCULATE( VALUES( DimSalesItem[Item]); FILTER( DimSalesItem; [Rank sales] = 1 ) )
Sorry that formula didn't seem to work, I get a can't display visual error. Could you explain the logic behind what it is trying to do?
Thanks
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 |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |