Forum Discussion

santoshlearner2's avatar
santoshlearner2
Icon for Resolver II rankResolver II
2 years ago
Solved

Date in Matrix Column how to sort ascending

Dear All,   I have a table in which there are calculated columns which does Plus minus of daily stock, the issue is when i put the dates in the matrix it sorts by ascending order, i tried creating ...
  • Ritaf1983's avatar
    2 years ago

    Hi santoshlearner2 
    For sorting the dates in descending order you need to have the column with its numeric value multiplied by (-1).
    To attach it from the date table that was made with pq you can
    1. duplicate the date column

    2. change the data type to whole number:

    3. multiply it by (-1)

    Close and apply, and modify the date sort by this new column from the table view :

    Result :

    Unfortunately, I couldn't find a solution for the scenario where you're using a calendar created with DAX. However, that type of calendar is less flexible. I recommend using a PQ calendar instead. I've attached a sample file for your reference. You can find more information about PQ calendars, including a script for creation, in the link.

    https://radacad.com/all-in-one-script-to-create-date-dimension-in-power-bi-using-power-query

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

  • Ritaf1983's avatar
    Ritaf1983
    2 years ago

    Try to download my file and follow the steps / share link to your pbix and I will check...

  • Ritaf1983's avatar
    Ritaf1983
    2 years ago

    You need to multiply it with (-1) not 1...
    The column for sorting should have negative numbers...