Forum Discussion
Rahul_SC
Helper IV
3 years agoGroup Ranking in Measure, and Bar chart
Hi, I have written dax for group ranking. It is working fine in table. The Ranking is dynamic. If I unselect a value from slicer (carrier name), the ranking gets updated for the selected values....
- 3 years ago
Rahul_SC
I hope this time is correctAllocated_Spend_New = VAR SelectedCarriers = ALLSELECTED ( 'Table'[Carrier] ) RETURN SUMX ( SUMMARIZE ( 'Table', 'Table'[LaneID], 'Table'[Carrier] ), VAR SumValue = [sum] VAR R1 = [Allocation % for R1] VAR R2 = [Allocation % for R2 Value] VAR R3 = [Allocation % for R3 Value] VAR RValue = SWITCH ( RANKX( SelectedCarriers, COALESCE ( [sum], 99999999999 ),, ASC, Dense ), 1, R1, 2, R2, 3, R3 ) RETURN SumValue * RValue )
tamerj1
Community Champion
3 years agoPlease try
RankMeasure =
RANKX (
CALCULATETABLE ( VALUES ( 'Table'[Carrier] ), ALLSELECTED ( 'Table'[Carrier] ) ),
[sum],
,
ASC,
DENSE
)
Rahul_SC
Helper IV
3 years agotamerj1 ,
Now, ranking is correct (it is dynamic) but the summarized table is incorrect. At total, the value is correct (Allocated Spend_New) but in the filter context, it is not.
I have doing if Rank1 (100%), Rank 2 or 3 then 0% of Total Simulation.
- tamerj13 years ago
Community Champion
Rahul_SC
Will have to use all in one measure.Allocated_Spend_New = VAR SelectedCarriers = ALLSELECTED ( 'Table'[Carrier] ) RETURN SUMX ( SUMMARIZE ( 'Table', 'Table'[LaneID], 'Table'[Carrier] ), VAR SumValue = [sum] VAR R1 = [Allocation % for R1] VAR R2 = [Allocation % for R2 Value] VAR R3 = [Allocation % for R3 Value] VAR RValue = SWITCH ( RANKX( SelectedCarriers, [sum],, ASC, Dense ), 1, R1, 2, R2, 3, R3 ) RETURN SumValue * RValue ) + 0- Rahul_SC3 years ago
Helper IV
Hi tamerj1 ,
Excellent,
Yes, it is perfect.
Just need to modify switch function a little. Actullay, if we are making changes in R2 slicer then it is calulating for R1 in the table. When we change in R3 slicer then it is calculating for R2 in table.
R1 slicer is not linked.