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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
lucadelicio
Super User
Super User

RankX in a measure

 

Goodmorning everybody,

i need your help!

I need to create a Rank in a measure.

 

I have my data with these columns:
Type - DateRif (YearMonth) - RESOURCE_UNIT_ID - REGION_ID - LOCAL_CUSTOMER_ID - Value

What i need is to create a measure to do ranking on the sum of value with the data group by:
TYPE - DateRif - RU Id - Region Id - Customer Id

(excluding the local customer rows detail)

So my visual will expose:
TYPE - DateRif - RU Id - Region Id - Customer Id - Value - RANK

 

The RANK value has to increment when the SUM(Value) will change month by month as the example below in november 2024 fr ru 22 in region 6:

lucadelicio_0-1712930235005.png

 

LATER ADDITION
The final result has to be to show the minimum date for every RANK of every RU ID that as MAX RANK > 1.
In this example:
January 2023 6 22 4091,40 1
November 2024 6 22 4115,30 2


As attachment the pbix with sample fake data.

Thank you vey much in advance!



Luca D'Elicio

LinkedIn Profile
1 ACCEPTED SOLUTION

4 REPLIES 4
lbendlin
Super User
Super User

How do you expect to break all the ties?  Please indicate expected result.

 

This may help you too:  Use of RANKX in Power BI measures - SQLBI

 

Hi @lbendlin ,

 

thank you for your answer.

I imagine to create a temporary table to do the group by for date - ru id - region id (without the customer id detail) and calculate the sum of the value.
Then i need the rank on this temporary when the sum of value change.

After this i have to filter only first value of every different rank for every ru id that has the max rank > 1.

In the attached pbix there is a possible formula, but it is not workin i need some help.

 

Thank you for your help.



Luca D'Elicio

LinkedIn Profile

lbendlin_0-1712958137237.png

 

Thank you very much, it was necessary only the RANK function and not the RANKX!



Luca D'Elicio

LinkedIn Profile

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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