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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ibuhary
Helper I
Helper I

RANKX

Hello there,

I have a table with Store ID, Store Name and Sales.

I have created a measure to Rank the Store Names based on highest sales.

StoreRank = RANKX(ALLSELECTED(
'Table'[Store Name]),
CALCULATE(SUM('Table'[Sales])),,DESC)

When I use the Rank alone with Store Name it works, but the moment I add store ID in the table it returns all ranks to - 1

Can anyone help me solve this issue, please.

1 ACCEPTED SOLUTION
sokg
Solution Supplier
Solution Supplier

Not in my test data. See pic below

 

Capture.JPG

View solution in original post

10 REPLIES 10
sokg
Solution Supplier
Solution Supplier

Why do you use ALLSELECTED instead of ALL???

Why do you use 'Table'[Store Name] instead of just 'Table'???

 

so try this

 

StoreRank =
RANKX ( ALL ( Table ), CALCULATE ( SUM ( 'Table'[Sales] ) ),, DESC )

In that case the ranks returned are all 1 for all the stores

sokg
Solution Supplier
Solution Supplier

Not in my test data. See pic below

 

Capture.JPG

Actually I have a larger database, but I cut it short to ask the question.

 

Is it possible to send it to you to check what I am doing wrong ?

sokg
Solution Supplier
Solution Supplier

Yes, my email is sokg@yahoo.com. You can send me your .pbix file.

Please check your privacy of your data. I assume you are allowed to do that.

 

 

I have sent you the file in your email

Hi, Have you been able to check my file.

sokg
Solution Supplier
Solution Supplier

I have not receive it.

Please send it again

 

sokg@yahoo.com

Please check, I sent again now.

Anonymous
Not applicable

Did you ever get a response? I have the same issue.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.