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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request 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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors