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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
tan_thiamhuat
Post Patron
Post Patron

PBI Sort Week according

although this is a PBI question, I hope I can post it here, as PBI is part of Fabric.

I have this Week defined as Date.ToText([BookTime], "ddd"), which shows "Mon", "Tue", "Wed", etc...

but when used it in the plot, it is sorted alphabetically as "Fri", "Mon", "Sat", "Sun", "Thu", etc, as seen below, which is not what I want. Can someone point me how to show that to be sorted as "Mon", "Tue", "Wed".... "Sat", "Sun?

 

tan_thiamhuat_0-1746761335990.png

 

1 ACCEPTED SOLUTION
suparnababu8
Super User
Super User

Hello @tan_thiamhuat 

 

You have to create a week number and sort the weekname column by using week number column. then you will get the expected week order in your line chart.

 

M-Code I used to create the week number column is 

= Table.AddColumn(#"Inserted Day Name", "Day of Week", each Number.Mod(Date.DayOfWeek([SalesDate], Day.Monday), 7), Int64.Type)

 

After creating this column select the weekname column from Table view and go to sort by column and select week number column. then automatically it will sort week from Monday to sunday. 

suparnababu8_0-1746767122887.png

Now you will get expected your result.

suparnababu8_1-1746767190273.png

 

Attached pbix file for your reference. Please let me know if it works.

 

Thank you!!

 

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

View solution in original post

2 REPLIES 2
burakkaragoz
Community Champion
Community Champion

Hi  @tan_thiamhuat ,

You can follow the steps below to sort the days of the week in Power BI in the correct order instead of alphabetically:

Create a Custom Sort Table:

Create a table containing the days of the week in the correct order. For example:

Gün | Sıra
----|-----
Mon | 1
Tue | 2
Wed | 3
Thu | 4
Fri | 5
Sat | 6
Sun | 7

 

Merge Tables:

Merge this custom sort table with your original data table. This allows you to add the correct sort number for each day.
Sort Settings:

In Power BI, use the “Order” column to sort the day column. To do this:
Select the day column.
From the “Sort” menu, select the “Sequence” column as “Sort By”.
By following these steps you can sort the days of the week in the correct order.

suparnababu8
Super User
Super User

Hello @tan_thiamhuat 

 

You have to create a week number and sort the weekname column by using week number column. then you will get the expected week order in your line chart.

 

M-Code I used to create the week number column is 

= Table.AddColumn(#"Inserted Day Name", "Day of Week", each Number.Mod(Date.DayOfWeek([SalesDate], Day.Monday), 7), Int64.Type)

 

After creating this column select the weekname column from Table view and go to sort by column and select week number column. then automatically it will sort week from Monday to sunday. 

suparnababu8_0-1746767122887.png

Now you will get expected your result.

suparnababu8_1-1746767190273.png

 

Attached pbix file for your reference. Please let me know if it works.

 

Thank you!!

 

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Helpful resources

Announcements
December Fabric Update Carousel

Fabric Monthly Update - December 2025

Check out the December 2025 Fabric Holiday Recap!

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.