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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
eeurton
Frequent Visitor

RANKX seems to be ranking on absolute value

I am using the formula below to create a ranking measure

 

Rank AvT = RANKX(
FILTER(
ALL('Fact - CIM Food Usage Summary'),
'Fact - CIM Food Usage Summary'[CONCEPT] = EARLIER('Fact - CIM Food Usage Summary'[CONCEPT])
&& 'Fact - CIM Food Usage Summary'[YR_MO_NBR] = EARLIER('Fact - CIM Food Usage Summary'[YR_MO_NBR])
&& 'Fact - CIM Food Usage Summary'[CNT_TYP_CD] = EARLIER('Fact - CIM Food Usage Summary'[CNT_TYP_CD])
&& 'Fact - CIM Food Usage Summary'[AVT_INCL_FLG] = "Y" 
),
[AVT_PCT_USE],,ASC,Dense)
 
It is not quite working as expected, the issue is that it seems to be ranking on absolute value rather than the actual value (see below) I would expect the -1.3% to be ranked first, not third, can someone offer a solution?
 
 image.png
 
 
 
3 REPLIES 3
JarroVGIT
Resident Rockstar
Resident Rockstar

Hi @eeurton ,

I love RANKX questions (I don't know why, I just like the logic I guess :P) but they are very hard to trouble shoot without having any data to replicate the issue. For example, you are using a measure to rank rows in a calculated column (I assume based on your EARLIER() statements), but you didn't give us the DAX of said measure. 

If at all possible, would you be able to share either the original PBIX or (if that contains confidential information) a PBIX with dummy data that still reflex your issue? If you don't want to share publicly, you can share by PM and I will have a look tomorrow. I'm sure I can figure this out for you 🙂

 

Kind regards

Djerro123

-------------------------------

If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

Keep those thumbs up coming! 🙂





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@JarroVGIT thanks for responding to my post! The measure that I am ranking (AVT_PCT_USE) is a calculated column in one of my tables, the formula is below:

 

if [CNT_TYP_CD] = "PERIOD" then (([OVRD_VAL_VRNC_AMT] + [SAP_COGS_EXP_AMT] - [VAL_ACT_UNIT_USED_AMT] - [SAP_SE_AMT] - [ROCK_SE_TOTAL_FOOD_COST]) / [SAP_COGS_EXP_AMT]) else [OVRD_VAL_VRNC_AMT] / [VAL_ACT_UNIT_USED_AMT])

 

if we need a pbix with data I will need to get back to you on Monday as I will need to restrict the model down to a historical period that is not sensitive and then refresh the data.

@JarroVGIT , thanks again for responding to my post, I was able to finally figure out the issue (user error). The problem was that the measure I am ranking was mistakenly set as a "text" data type, once I changed that to a decimal number data type the RANX measure started working as expected.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors