cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
smore
Helper I
Helper I

Using a RANKX values as Y-Axis in Stacked Bar Chart

I have a field Table with columns Tree # and Apple Diameter. I want to rank the apples by largest diameter based on a slicer selection of whichever Tree # is selected. The final visual is a Stacked Bar Chart with Rank # on the Y-axis and Diameter on the X-axis.

I created a measure to Rank based on Diameter:

Rank Measure  =

RANKX(

          ALLSELECTED('Table1),

          CALCULATE(SUM(‘Table'[Diameter]))

          ,, DESC

)

This measure works in a Table Visual with the rank changing based on whichever Tree # is selected but Power BI Desktop does not allow me set the Rank measure as the Y-Axis in my Stacked Bar Chart. I can only add the RANK measure in the VALUES field of the bar chart. How do I work around this?

I tried creating a calculated column in Table 1 with using the DAX from the Rank Measure posted above but I receive the error :"A circular dependency was detected: Table1[RankColumn]."

So far: I can use a calculated column on Table1 as the Y-axis but cannot get the Rank working. I have a Rank Measure working but cannot use it as a Y-axis. Please help. Thanks.

1 REPLY 1
V-lianl-msft
Community Support
Community Support

Hi @smore ,

 

Based on your description, I'm not clear about your data model.Any chance you can share a PBIX file with dummy data?

https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-... 

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors