Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

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?Capture.PNG

 
1 ACCEPTED SOLUTION
d_gosbell
Super User
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?

View solution in original post

2 REPLIES 2
amitchandak
Super User
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-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
d_gosbell
Super User
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?

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.