Forum Discussion
wacook
3 years agoFrequent Visitor
Dynamic Index with Split Data Set
Hi, I have a dataset that looks like: ID Sales Period Index % of Total 123 $10 Current Year 1 50% 223 $5 Current Year 2 100% 122 $17 Prior Year 1 33% 222 $12 Pri...
mark_endicott
2 years agoSuper User
wacook - here's the DAX for a dynamic index based on the first 3 columns of your table. If you dont need columns in your visual, you can remove them from the ALLSELECTED().
It is made dynamic because of the PARTITIONBY, which resets the RANK every change of period.
Index = RANK(DENSE, ALLSELECTED( 'Table (3)'[ID], 'Table (3)'[Period], 'Table (3)'[Sales] ) , ORDERBY( 'Table (3)'[Sales],DESC), LAST, PARTITIONBY( 'Table (3)'[Period] ))
If this works for you, please mark it as the solution.