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.
I am having trouble getting my rankx function to work. I have visited so many threads with similar questions but still can't seem to figure it out.
I have a table with product skus, item IDs, revenue amounts, etc. and want to rank them based on the revenue amount (item with the highest revenue will have a ranking of 1).
Here is my code, but I have tried so many variations of this (without sum, without calculate, without both, without DESC, without [sku], etc.)
Rank = rankx(ALL('PH FY 2016'[sku]),CALCULATE(SUM('PH FY 2016'[Net Revenue])),,DESC)
The table won't load with this current code, and the closest I've gotten has returned all 1s. Any help is much appreciated!
Solved! Go to Solution.
I got it working with this code:
Rank = rankx(ALLSELECTED('PH FY 2016'[sku]),CALCULATE(SUM('PH FY 2016'[Net Revenue]), ALLEXCEPT('PH FY 2016','PH FY 2016'[sku], 'Cat DICT'[Category])))
If you are using a calculated Column:
Try with:
Ranking = RANKX(Table1;table1[Net Revenue];;DESC)
Regards
Victor
Lima - Peru
I am getting this error: A single value for column 'Net Revenue' in table 'PH FY 2016' cannot be determined.
I used this code...
Rank = rankx('PH FY 2016','PH FY 2016'[Net Revenue],,DESC)
The Net Revenue column is not calculated - it was on the Excel table that I imported into Power BI.
I got it working with this code:
Rank = rankx(ALLSELECTED('PH FY 2016'[sku]),CALCULATE(SUM('PH FY 2016'[Net Revenue]), ALLEXCEPT('PH FY 2016','PH FY 2016'[sku], 'Cat DICT'[Category])))
Glad to hear that you've solved this problem. You could help mark it as answer. Your contribution is highly appreciated.
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |