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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bschmiedeler
Frequent Visitor

Bar Chart: sort x-axis on Year and Month while displaying Month as Text

I am showing a bar chart with date data on the x-axis. I want to group the data by Year Month, like so:

 

c1.png

Here I have data from June 2019 to February 2020, grouped by Month. The years are at the bottom as I am not concantanating the labels. 

 

Someone made a hierarchy for me called Arrived Year Hierarchy and that allowed me to get the sort correct. The only thing I would like to do now, and it is really just a nice to have, but I would prefer to keep the sort on Year/Month but report month in text, so 6 is June and so on. I have read several posts but cannot glean from them what to do.

 

c2.png

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@bschmiedeler you should use sort by feature,  so assuming you have Month in text, Jan. Feb...March...and so on,

 

add another column in your model for month number

 

Month Number = MONTH ( YourTable[YourDate] )

 

Select your Month column and go to column tools menu and from there in sort by drop down, choose Month Number. Basically you are telling that Month column is sorted by month number column.

 

Now if you use Month (text) column on x-axis, it will be sorted out correctly.

 

Would appreciate Kudos 🙂 if my solution helped.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

1 REPLY 1
parry2k
Super User
Super User

@bschmiedeler you should use sort by feature,  so assuming you have Month in text, Jan. Feb...March...and so on,

 

add another column in your model for month number

 

Month Number = MONTH ( YourTable[YourDate] )

 

Select your Month column and go to column tools menu and from there in sort by drop down, choose Month Number. Basically you are telling that Month column is sorted by month number column.

 

Now if you use Month (text) column on x-axis, it will be sorted out correctly.

 

Would appreciate Kudos 🙂 if my solution helped.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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