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
ogend
Helper II
Helper II

Sorting in the Bar Chart

Hello guys, 

 

I have a simple bar chart - it slices the data  by a numeric variable on Y- axis , categorical on X- axis and period (year) further slices under the legend

 

I need to sort the chart  by the value of the most recent year, from 1 to 2 per picture below 

 

ogend_0-1678575849848.png

I could not figure out how to do that using the bar chart, and ended up setting up measures where the most current year  in the data (Max[CurrentYEar])  is Current Year, the Prior Year = Current Year -1 etc. Now I can sort the visual by Current Year value, but my problem is that i don't know if it's possible to dynamicaly label the years. Right now I am picking up measures CY, CY-1, etc. and manually use "rename for this visual" feature to change the years. This is a published report that pulls from a database, if I don't catch the day the new year data becames availalble, the users are misguided. 

Would you know if there is a way to achieve what I am looking for - to sort by the value of the most recent year, and have dynamic lableing so I don't have to worry about renaming through "rename for this visual"? 

 

Thank you!

1 REPLY 1
Ashish_Mathur
Super User
Super User

Hi,

I am not sure how much i can help but i would like to try.  Share the download link of the PBI file


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.