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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
nknareshkumar21
New Member

PowerBi_Rankfunction_query

Can you please help with below?
This is my table

nknareshkumar21_0-1744087869048.png

Below is the function used

 

nknareshkumar21_0-1744088570190.png

 

Need Help

I am getting 1 for all rows,I need it to show over all rank of the table

Thanks

Naresh

1 ACCEPTED SOLUTION
V-yubandi-msft
Community Support
Community Support

Hi @nknareshkumar21 ,

To resolve this, you can use the RANKX  function inside a calculated column instead. This will calculate the rank across the entire table.

 

 

1.Go to Modeling > New Column in Power BI Desktop.

Use the following DAX formula:

Rank = 
RANKX(
    ALL('Table (2)'),
    'Table (2)'[Revenue],
    ,
    DESC,
    DENSE
)

2. Replace "Your Table Name" with the actual name of your table.

3. Add this Rank column to your visual alongside Country, Product, and Revenue. 

This will correctly assign a unique overall rank to each row based on Revenue.

 

Result:

Vyubandimsft_0-1744129946849.png

 

Vyubandimsft_2-1744130117316.png

 

 

 

If my response solved your query, please mark it as the Accepted solution to help others find it easily.

And if my answer was helpful, I'd really appreciate a 'Kudos'.

 

View solution in original post

5 REPLIES 5
V-yubandi-msft
Community Support
Community Support

Hi @nknareshkumar21 ,

Has your issue been resolved, or do you require any further information? Your feedback is valuable to us. If the solution was effective, please mark it as 'Accepted Solution' to assist other community members experiencing the same issue.

V-yubandi-msft
Community Support
Community Support

Hi @nknareshkumar21 ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution we provided for your issue worked for you  or let us know if you need any further assistance?

Your feedback is important to us, Looking forward to your response. 

V-yubandi-msft
Community Support
Community Support

Hi @nknareshkumar21 ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution we provided for your issue worked for you  or let us know if you need any further assistance?

Your feedback is important to us, Looking forward to your response. 

V-yubandi-msft
Community Support
Community Support

Hi @nknareshkumar21 ,

To resolve this, you can use the RANKX  function inside a calculated column instead. This will calculate the rank across the entire table.

 

 

1.Go to Modeling > New Column in Power BI Desktop.

Use the following DAX formula:

Rank = 
RANKX(
    ALL('Table (2)'),
    'Table (2)'[Revenue],
    ,
    DESC,
    DENSE
)

2. Replace "Your Table Name" with the actual name of your table.

3. Add this Rank column to your visual alongside Country, Product, and Revenue. 

This will correctly assign a unique overall rank to each row based on Revenue.

 

Result:

Vyubandimsft_0-1744129946849.png

 

Vyubandimsft_2-1744130117316.png

 

 

 

If my response solved your query, please mark it as the Accepted solution to help others find it easily.

And if my answer was helpful, I'd really appreciate a 'Kudos'.

 

johnt75
Super User
Super User

When you calculate the sum you need to force context transition, so that the sum is calculated for the correct combination of country and product

Rank = RANKX( ALL('Table'), CALCULATE( SUM('Table'[Revenue]) ),,DESC, Dense )

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors