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
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 an 8 times 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 an 8 times 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
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.