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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Rank Formula Assistance

I am trying to rank companies based on their revenues in my data set.  It is a large data set with many rows of data for each company in a year and am looking for their rank based on revenue largest to smallest within the year I am filtered to across my Power BI file.  

 

Formulas I am using:

 

1 Rank = RANKX(ALL('table'[company_name]),[Revenue])

1 Walmart Rank = If ([Walmart Revenue] = 0,0,Calculate ([1 Rank],'table'[company_name]="Walmart"))

 

The goal is to have it return Walmarts rank across different product categories I have in the first column of my table.   (Ex:  Electronics in row 1, Apparel in row 2 - I want to see how walmart ranks by revenue compared to other companies for each category). 

 

The issue I am running into with my formulas is that Walmart is number one when I look at the raw data, but is showing up as number 2 when i use the '1 Walmart Rank' formula in my table.

 

Will appreciate any assistance that can be provided!

 

Thank You 

 

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

It would be more helpful for us to understand your purpose if you could share some dummy data and expected result. When a Rank formula is in a measure in the report or in a calculated column, it may return different results because the context for calculation is different. Also, when you only use ALL in the formula, the category will not be taken into account. 

 

Best Regards,
Community Support Team _ Jing

Greg_Deckler
Community Champion
Community Champion

@Anonymous Hard to know for sure without sample data. To *Bleep* with RANKX! - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors