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
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
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