Search code examples
powerbidaxpowerbi-desktop

How to sort weekdays in Power BI based on today


How can I sort days of week from right to left.

something like this:

enter image description here

This is what I have now:

enter image description here

I created column DayOfWeekSort but it gives me an error:

enter image description here

enter image description here


Solution

  • If you use TODAY() in a calculated column, it only updates whenever that column is recalculated (e.g. when the model is refreshed). Since you said your report is refreshed daily, this is good enough.

    Try this:

    DayOfWeekSort = MOD ( [Date] - TODAY (), 7 )
    

    This gives 0 for today and increases up to a maximum of 6 and starts over.


    As the error message says, you can't map, say, Tuesday to more than one value in a column to sort by, so the sorting column can't have more unique values than the column you are trying to sort.