Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rankx dax function in column with complicated measure

 am having an issue with using the rankx function in a column in my table. I can calculate the rank with a measure, but I need to use the rank values as the x-axis on a bar chart. So, I guess I need to calculate the rank value in a column in my table. 


My other issue is that the value "expression" used for rankx is a measure consisting of a bunch of other measures, calculated from different rows in my main table. 


The measure used is a forecast that that looking at the year-to-date cost from last year compared to the hole last year cost. This percentage value is then used to calculate a forecast of this year cost, using the year-to-date cost for this year. This forecast measure is then compared to the total budget of this year, to see if the different counties are expected to keep their budget. 


This forecast vs budget measure is what I want so rank between the different counties. 


As the measure is complicated, I often get an error saying that there is a circular reference. Or I just get a bunch of 1's. 

Here is a report where I have illustrated the issue.!Akk3xPcd4O64gaop19baJ5m1yd6ENA?e=soxb3l


Super User
Super User

but I need to use the rank values as the x-axis on a bar chart.


RANKX is an iterator function, it works over rows.   Putting it in a measure is always tricky.  And then trying to use that measure as another column (your x axis) is where stuff breaks the fabric of spacetime.


Use of RANKX in Power BI measures - SQLBI


You need to create a disconnected table for your expected values (  GENERATESERIES(1,10)   etc)  and then tie the measure to that table.  That will allow you to select the table column for the x axis.

Helpful resources

May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors