Forum Discussion

tan_thiamhuat's avatar
tan_thiamhuat
Post Patron
1 year ago
Solved

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 us...
  • suparnababu8's avatar
    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!