Forum Discussion
PBI Sort Week according
- 1 year ago
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.
Now you will get expected your result.
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!
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.