Forum Discussion
rampsaladi
8 years agoFrequent Visitor
Dynamic Rank per Product in Time Period
Hi I need to be help create a Rank column. I need to be able to generate the rank in the context of the Time Period for the Products based on the Amount and This rank will be in the context of t...
Greg_Deckler
8 years agoCommunity Champion
So, are you OK if this is a measure? I have had far more luck with RANKX as a measure versus as a column. You could create two measures:
MySum = SUM(Table[Amt]) MyRank = RANKX(ALL(Table),[MySum])
You can create a column like this:
Column = RANKX(aRanks,[Amt])
But it won't be grouped like you want. Here is one of the better articles explaining RANKX:
Zubair_Muhammad
8 years agoCommunity Champion
GIve this MEASURE a shot as well
RANK =
RANKX (
FILTER (
ALLSELECTED ( Table1 ),
Table1[Time Period] = SELECTEDVALUE ( Table1[Time Period] )
),
CALCULATE ( SUM ( Table1[Amt] ) ),
,
DESC,
DENSE
)
- Zubair_Muhammad8 years agoCommunity Champion
Infact this one should give the proper results with slicers
RANK = RANKX ( CALCULATETABLE ( VALUES ( Table1[Product] ), FILTER ( ALLSELECTED ( Table1 ), Table1[Time Period] = SELECTEDVALUE ( Table1[Time Period] ) ) ), CALCULATE ( SUM ( Table1[Amt] ) ), , DESC, DENSE )- rampsaladi8 years agoFrequent Visitor
Thank you for providing the information but the DAX you provided does not give me the correct result, it always gives rank as 1
- Zubair_Muhammad8 years agoCommunity Champion