Forum Discussion
How to use RankX and Summarize
We need to return a table where we can look at all products for 2018 and 2019 and to be able to filter on the ranking of the customer's total spend in 2018 on all products (ranked against spend for other customers in 2018). How would we use Rankx and Summarize to do this. Any other suggestions?
If I understand your requirements correctly I think the following will work. It calculates the ranking for a product across all customers based on the 2018 sales.
Measure = RANKX(CALCULATETABLE('Table', ALL('Table'[Customer]), 'Table'[YearOfSale] = 2018), calculate(SUM('Table'[Total Spend by Year])))If this is not what you are after can you post your expected results based on the dataset above?
2 Replies
- d_gosbell
Super User
If I understand your requirements correctly I think the following will work. It calculates the ranking for a product across all customers based on the 2018 sales.
Measure = RANKX(CALCULATETABLE('Table', ALL('Table'[Customer]), 'Table'[YearOfSale] = 2018), calculate(SUM('Table'[Total Spend by Year])))If this is not what you are after can you post your expected results based on the dataset above?
- amitchandak
Super User
Try
Year Rank= RANKX(all('Table'[year Of sales]),[Total Spend By Year],,DESC,Dense)Also refer : https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners/ba-p/890814
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p/881739
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601