top of page

Find Dense Rank By Average Value In Power BI


In this article, we will learn how we can add the "Continues Rank by Average" value in Power BI.


We have two tables with a One to Many Relationship.

  • Facility-Doctor

  • WaitTime

Please refer to the following relationship diagram.

We need to give a Rank to all the Physicians by their Average Wait Time. The end result that we want here is, tabular data with Physician Name, Average Wait Time, and Rank of their Average Wait Time.

For your practice, I have attached the dataset sample and Power BI file on GitHub. You can download it using the following URL. Download Sample Files

The same article is available in video form. You can watch the video using this link.

Power BI facilities apply Rank functionality using RANKX() function. Now, let’s get started!

Step 1

Create a Measure in Facility-Doctor Table to find an Average.

Average = AVERAGE(WaitTime[Waiting Time Per Appointment])

Step 2

Apply RANKX function to find out the Rank.

Here, we will use RANKX function to add the Rank Number.


1. RANKX(<table>, <expression>[, <value>[, <order>[, <ties>]]])


  • Table = The name of the table on which we need to apply our DAX expression.

  • Expression = Any DAX Expression that returns a single scalar value.

  • Value = OptionalOrder = ASC/DESC

  • Tiles = An enumeration that defines how to determine ranking when there are ties.

  • Values for the tiles are: DENSE/SKIP

In our case, we will use following DAX expression which is RANKX().

1. RankByWaitTime = RANKX(ALL('Facility-Doctor'),[Average],,ASC,Dense)


  • ALL('Facility-Doctor') = We need to evaluate our entire DAX expression on Facility-Doctor table without allowing any filters. That’s why we have used this expression.

  • [Average] = Find Average for every Physician.

  • We have already mentioned the formula for the Average in Step 1 as well.

  • ASC = To sort the Rank in Ascending order.

  • Dense= We want to show continuous Rank so we have used Dense Rank here.

Step 3

Now, let’s test the function.

Add the value in the Table visual.

We have a result like this.


This is how we can apply the Dense Rank within Power BI.

I hope you love this article! Stay connected with me for more amazing articles like this.



bottom of page