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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
tan_thiamhuat
Helper V
Helper V

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
Fabric July 2025 Monthly Update Carousel

Fabric Monthly Update - July 2025

Check out the July 2025 Fabric update to learn about new features.

July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.