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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
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. 

 

https://1drv.ms/u/s!Akk3xPcd4O64gaop19baJ5m1yd6ENA?e=soxb3l

 

1 REPLY 1
lbendlin
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

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.