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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
smore
Advocate I
Advocate 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.