Forum Discussion

aksharacoomar's avatar
5 years ago
Solved

Date Sort not working in Matrix

I am creating a table on PowerBI which reports on plans vs. actuals and needs to be broken out by year/quarter/month/week number/date. I have been successful in creating the table but the dates are somehow getting messed up. Please see my screenshot below -

 

The date is not getting sorted somehow - I tried to sort the table by date but it doesn't work. Please see my calendar table below to see how my date table is laid out- 

I want the dates to be sorted so the naming of the weeks can align correctly, for eg: June Wk5 should appear before July Wk1. The sort by column did not work for the data. Thank you in advance! 

 

  • V-lianl-msft's avatar
    V-lianl-msft
    5 years ago

    Hi aksharacoomar ,

     

    Sort the month name using the month number.

    Then create a "week num" column, and then sort the "week no" column by "week num" column.

     

    weeknum = WEEKNUM(Sheet5[Date],1)

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

  • aksharacoomar,

     

    You need to use "Sort by column" in the Data view. Click on the column to be sorted (Week no), click "Sort by column", and select the column to sort by (e.g., Week Number, data type = Whole number). You might rename "Week no" as "Week Name", to avoid confusion with "Week Number".

     

     

     

    • aksharacoomar's avatar
      aksharacoomar
      Icon for Helper I rankHelper I

      Hey, thank you so much for your suggestion but unfortunately it didn't work. 

    • aksharacoomar's avatar
      aksharacoomar
      Icon for Helper I rankHelper I

      aksharacoomar_0-1607056937886.png

      @DataInsights I sorted the data as per your recommendation, yet the data is not sorting. I tried sorting the date column as well but the date column starts with July rather than January.

      Do you know how I can fix this?

      • V-lianl-msft's avatar
        V-lianl-msft
        Icon for Community Support rankCommunity Support

        Hi aksharacoomar ,

         

        Sort the month name using the month number.

        Then create a "week num" column, and then sort the "week no" column by "week num" column.

         

        weeknum = WEEKNUM(Sheet5[Date],1)

         

        Best Regards,
        Liang
        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.