Forum Discussion
rampsaladi
8 years agoFrequent Visitor
Dynamically Calculating Rank based on Slicer
I have the following sample Dataset and I need to be able to rank the SKU based on the $ Amount for a specific time period and product combination. The user wants to see ranks for multiple time periods but these need to change based on Product selection as a slicer. Below is the data. Any help would be appreciated
| Time Period | Products | SKU | $ Amount |
| Last 4 Weeks | A | AA | 1 |
| Last 4 Weeks | A | AB | 3 |
| Last 4 Weeks | A | AC | 0.5 |
| Last 4 Weeks | B | BA | 2 |
| Last 4 Weeks | B | BB | 1 |
| Last 4 Weeks | B | BC | 6 |
| Last 16 Weeks | A | AA | 3 |
| Last 16 Weeks | A | AB | 4 |
| Last 16 Weeks | A | AC | 1 |
| Last 16 Weeks | B | BA | 4 |
| Last 16 Weeks | B | BB | 6 |
| Last 16 Weeks | B | BC | 7 |
Rank = RANKX ( ALLSELECTED ( TableName ), CALCULATE ( SUM ( TableName[$ Amount] ) ), , DESC, DENSE )
3 Replies
- RfrancaResolver IV
hi, rampsaladi
rankn = RANKX(ALL(tabela[Time Period];tabela[Products];tabela[SKU]);[TT_Amount];;ASC;Dense)
- Zubair_MuhammadCommunity Champion
Rank = RANKX ( ALLSELECTED ( TableName ), CALCULATE ( SUM ( TableName[$ Amount] ) ), , DESC, DENSE )- rampsaladiFrequent Visitor
Thank you this helps