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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
CourtneyB
Frequent Visitor

RANKX Help!

Hi Everyone,

 

I am hoping someone can help me becausebecause this RANKX is really giving me a run for my money. I am fairly new to Power Bi and have been teaching myself as I go and I have hit a wall with this one. I need to rank different companies average turn times (i.e. how long it took them to deliver the product from start to finish) from lowest to highest time by state. Any help is much appreciated. 

 

 

 

1 ACCEPTED SOLUTION

Hi All, 

 

So, my boss was able to figure it out. the correct formula to use for my case is the following:

 

Rank = RANKX(ALLSELECTED('2821_410_700_150'[CompanyName]), CALCULATE(AVERAGE('2821_410_700_150'[TT100150_CD])),,ASC,Dense)-1

 

Thank you for all your imput and assistance.

View solution in original post

12 REPLIES 12
CourtneyB
Frequent Visitor

Example of what I am looking to accomplish except a new column would be entered with the rankingsRANKX Help.png

RANKX ( ALL (Table[Company] ), [Avg Tat BD] )

@mattbrice it is not allowing me to enter the [avg TAT BD]. In the matrix, i have the TAT BD to average and not sum if that makes a difference?

Hi @CourtneyB, can you show us your latest version of RANKX formula ? 

@DAX0110 I didnt have anything established as i kept getting errors but with @mattbrice's formula and adding Average() it just gave me all Rank 1s. I dont know if it makes a difference but each row in the data gives the order level Turn Time, so when i pull that field into the matrix i have it average instead of sum.

 

Rank = RANKX(ALL('2821_410_700_150'[CompanyName]),AVERAGE('2821_410_700_150'[TT100150_BD]))

 

RANKX Help2.png

I assumed that you only had 'Table[State]' and 'Table[CompanyName]' on the rows and 'Order Count' and 'Avg TAT BD' were already measures.   So the Rank measure as written should work.  I don't understand why you were getting an error. What specifically was the error you got, and what exactly was the measure you wrote?

@mattbrice I have added the measure to do Avg TAT BD instead of formating it to be average in the matrix and now it let me use it in the RANKX formula however it is not populating the ranks correctly

 

RANKX Help3.png

Hi @CourtneyB,

 

Share the link from where i can download your file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur I'm sorry, I do not know how to create a link for you to download the file. I have played around more with the data and got the formula to mostly work except there isnt a rank 1 populating. Here are some screenshot detail that hopefully will help

 

Current RANKX FormulaCurrent RANKX Formula

 

Visualization DetailsVisualization DetailsSnapshot of dataSnapshot of dataMeasure for Avg TAT BD being usedMeasure for Avg TAT BD being used

HI @CourtneyB

 

Give this a shot

 

Rank =
RANKX (
    ALL ( '2821_410_700_150'[State], '2821_410_700_150'[CompanyName] ),
    AVERAGE ( '2821_410_700_150'[TT100150_BD] )
)

Hi All, 

 

So, my boss was able to figure it out. the correct formula to use for my case is the following:

 

Rank = RANKX(ALLSELECTED('2821_410_700_150'[CompanyName]), CALCULATE(AVERAGE('2821_410_700_150'[TT100150_CD])),,ASC,Dense)-1

 

Thank you for all your imput and assistance.

What is ‘Avg TAT BD’ measure you wrote?   Are there other table/page/report filters being applied to matrix?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors