Download File:
Start File: https://excelisfun.net/files/EMT1419Start.xlsx
Finished File: https://excelisfun.net/files/EMT1419Finished.xlsx
Entire page with all Excel Files for All Videos: https://excelisfun.net/
See how to use the RANKX Function in DAX. Learn :
1. (00:15) Introduction. Look at Finished Data Model PivotTable. Look at Established Data Model.
2. (02:24) Create Total Profit Formula, start PivotTable.
3. (04:14) Discuss how Filter Context works in the Data Model.
4. (04:55) Start Discussion of how the RANKX Function works
5. (05:30) DAX Formula to Rank Total Profits for Products: RANKX(ALL(dProduct),[Total Profit])
6. (06:47) Discussion of last three arguments in RANKX, arguments that are not mandatory if you know what the default behavior is.
7. (08:15) RANKX ranks everything first? Potential Pitfall with RANKX when you use an aggregate function in the expression argument, rather than a Measure. Learn about the “hidden CALCULATE Function” around each measure that performs Context Transition, which converts an existing ROW Context into the equivalent Filter Context and helps RANKX to work correctly.
8. (09:21 and 10:35) Visual of what happens when you use SUM Function in RANKX without the CALCULATE Function. Visual of why you get a rank of one in every cell of the PivotTable.
9. (11:36) Use IF and HASONEVALUE to display a BLANK() in the Grand Total Cell
10. (14:03) When we drop Manufactory Field from product Table into the Row Area of the PivotTable, our formula does not calculate Rank for ONLY Product. We fix it by putting entire dProduct Table into ALL Function. Discussion of the ALL DAX Function.
11. (16:09) Format PivotTable
12. (16:46) DAX Formula to Rank Total Profits by Product within Manufacturer :=IF(HASONEVALUE(dProduct[Product]),RANKX(ALLEXCEPT(dProduct,dProduct[Manufacturer]),[Total Profit])) . Learn about the ALLEXCEPT DAX Function.
13. (18:39) DAX Formula Rank Unit Profits for Products :=IF(HASONEVALUE(dProduct[Product]),RANKX(ALL(dProduct),dProduct[Unit Profit],VALUES(dProduct[Unit Profit])))
14. (19:11) How do you use third argument in RANKX, the Value argument? We use a column reference in the Expressions argument (second argument) and then the VALUES function in the Values argument WITH IF and HASONEVALUE functions to assist VALUES to get correct answer.
15. (22:28) Close up of how third argument in RANKX, Values argument, works.
16. (23:22) DAX Formula to Rank Unit Profits by Product within Manufacturer :=IF(HASONEVALUE(dProduct[Product]),RANKX(ALLEXCEPT(dProduct,dProduct[Manufacturer]),CALCULATE(SUM(dProduct[Unit Profit]))))
17. (26:17) Summary

Related Videos:
Excel Magic Trick 1417: Excel Functions Ranking For Unit & Total Profit for Products within Manufacturer
Excel Magic Trick 1418: PivotTables Ranking For Unit & Total Profit for Products within Manufacturer
Excel Magic Trick 1419: RANKX DAX Function & More: Ranking Profit for Products within Manufacturer
Excel Magic Trick 1420: Ranking in Power Query: Sort, Grouping, Indexes and Custom Columns