Forum Discussion
Need help with a Rank function in DAX
- 3 years ago
Hi julianst24
Since one countrytier may have duplicated prices, we need to distinguish them when ranking. You can first add an Index column with Power Query Editor. Apply the change to the model.
Then create a calculated column with below code. It calculates the ranking based on the expression 'Table'[checking final price] + 'Table'[Index] * 0.000001.
Rank = RANKX ( FILTER ( 'Table', 'Table'[countrytier for rank global] = EARLIER ( 'Table'[countrytier for rank global] ) ), 'Table'[checking final price] + 'Table'[Index] * 0.000001, , ASC, DENSE )Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi julianst24
Since one countrytier may have duplicated prices, we need to distinguish them when ranking. You can first add an Index column with Power Query Editor. Apply the change to the model.
Then create a calculated column with below code. It calculates the ranking based on the expression 'Table'[checking final price] + 'Table'[Index] * 0.000001.
Rank =
RANKX (
FILTER (
'Table',
'Table'[countrytier for rank global]
= EARLIER ( 'Table'[countrytier for rank global] )
),
'Table'[checking final price] + 'Table'[Index] * 0.000001,
,
ASC,
DENSE
)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Thanks!!