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

Sort by 24-Hour, label by 12-Hour

Greetings,

I have a Line and Stacked Column Chart visual that is oh so close to what the user wants, but not quite.

The desired X-Axis Sort is Ascending 24-Hour Time, but the desired X-Axis labels are 12-Hour AM/PM time. 

I have a TimeDimension query with both an "Hour" field, formatted with leading Zero, and a calculated column 

Hour AM/PM = FORMAT(TimeDimFall[Time],"H AM/PM").
Using "Hour" as the X-Axis produces the correct sort:
2021-02-10 (1).png
 
 
 
 
 
The user doesn't want to see hour "13", they want to see the label "1 PM"
Using Hour AM/PM in the visual lists "1 AM" first then "1 PM" next:
2021-02-10 (2).png 
 
 
 
 
 
How do I get the correct sort with the desired X-Axis labels?
 
1 ACCEPTED SOLUTION

Add the label column to the axis. Click on the label column in the fields list and select "sort by column" and use the 24 hour column for sorting. 



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

2 REPLIES 2

Add the label column to the axis. Click on the label column in the fields list and select "sort by column" and use the 24 hour column for sorting. 



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Brilliant! I had to walk through the steps a couple of times, but I got it.

Thank you @MattAllington !

Helpful resources

Announcements
May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through June10th!

Power BI Dev Camp Session 22 without aka link and time 768x460.jpg

Check it Out!

Watch Session 22 Ted's Dev Camp along with past sessions!

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!

Top Kudoed Authors