Forum Discussion
aktripathi2506
10 years agoHelper IV
Ranking function not working with slicer
I have these three columns in my table. Now I want to show top 5 based on the maximum hours. I have applied following formula RANKX(ALLSELECTED('Table'[Name]),CALCULATE(SUM('Table'[Hours]))) ...
MattAllington
10 years agoCommunity Champion
I suggest you extend your data model into a star schema. Read my article here http://exceleratorbi.com.au/the-optimal-shape-for-power-pivot-data/
Then create a Year table and a Name table. and put the columns from those table in your visual.
then write this formula
RANKX(ALL(NameTable),CALCULATE(SUM('Table'[Hours])))
Alternatively you could just use this,
RANKX(ALLEXCEPT('Table','Table'[Year]),CALCULATE(SUM('Table'[Hours])))
but that would miss a learning opportunity :-)