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
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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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