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
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors