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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
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

lbendlin_0-1712958137237.png

 

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

Luca D'Elicio

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.