Forum Discussion
Anonymous
4 years agoNot applicable
DAX: Ranking a measure based on a Column
Hello All, I am trying to create ranking of sales by customers and customer groups. Now these customers are been grouped as tier 1 and tier2. But in visualization I am using only Customer co...
- 4 years ago
Hi, Anonymous ;
Try it.
Total Sales = CALCULATE(SUM('Table'[Sales]),FILTER(ALLSELECTED('Table'),[Customer Group]=MAX('Table'[Customer Group])&&[Customer]=MAX('Table'[Customer])))Top 5 Customers = RANKX( FILTER( ALL('Table'),[Tier1/2]=MAX('Table'[Tier1/2])), CALCULATE( [Total Sales]) ,, DESC,Dense)The final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yalanwu-msft
4 years agoCommunity Support
Hi, Anonymous ;
Try it.
Total Sales = CALCULATE(SUM('Table'[Sales]),FILTER(ALLSELECTED('Table'),[Customer Group]=MAX('Table'[Customer Group])&&[Customer]=MAX('Table'[Customer])))Top 5 Customers =
RANKX(
FILTER( ALL('Table'),[Tier1/2]=MAX('Table'[Tier1/2])),
CALCULATE(
[Total Sales])
,,
DESC,Dense)
The final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.