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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Time, Hour should not sorting on Line Graph Automatically

Hello, 

 

I created a line graph on my project with X-axis being a column, Hour Extended, in my Time table (... "Hour Extended", FORMAT([TimeandDay], "H AM/PM"),...) and Y-axis being a column, Lemonade, in my Drinks table (SearchHistory = COUNTROWS(SearchHistory)). The Hour Extended column was added as column to a blank table and the Lemonade column was added as a calculated column my main table Drinks. 

 

Please use the interpretation of an image below and the picture as guidance. In a general solution, how should I go about creating a line graph without the sorting of times. I do not want to explicitly explore the time by hours maximum to minimum, but would like to see every hour in order morning to afternoon. Thank you for any help. If the post information is not helpful, any general solution or approach would be much appreciated.

 

Current graph:

picture1.jpg

|

|

|                                  Line graph goes here

|

|

|

______________________________________________________________________

12PM         3PM        5PM        9AM         11AM         6PM         10AM        

 

 

My expectation: 

|

|

|                                  Line graph goes here

|

|

|

______________________________________________________________________

9AM         10AM        11AM        12PM         3PM         5PM         6PM       

 

Thank you for any guidance.

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

When using Format() function, it converts a value to text according to the specified format, refer: Format() 

format text.png

Try to change the data type from text to time and it may sort by time normally as your expected.

format time.png

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

When using Format() function, it converts a value to text according to the specified format, refer: Format() 

format text.png

Try to change the data type from text to time and it may sort by time normally as your expected.

format time.png

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

When you use FORMAT you change it to a text value so it sorts alphabetically. 

 

I would recommend military time hours and use the technique for display found here: https://community.powerbi.com/t5/Quick-Measures-Gallery/Chelsie-Eiden-s-Duration/td-p/793639



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.