Forum Discussion

showy's avatar
showy
Icon for Helper II rankHelper II
1 year ago
Solved

Change sorting only in one visual visual calc

Hi
i have a big report with some matrix. There the month are the colums. I sort them with a monthSort colum in the datedimesion.
Jan = 1, Feb =2 , Mar = 3 .... Dez = 12
Everything is working fine.

Now i have one matrix where i want to have a reverse order. In case of 2025 i should start with May, April, Mar, Feb and end with Jan.

My idea is to build an copy of the month colum in the datedimension as monthReverse and also a monthSortReverse column.
Then i would use this monthReverse in the Matrix because its only need for one matrix and shouldn't affect the other matrix.


Is there a better way to do this? Maybe on the level of visual calc?


Thanks๐Ÿ˜€

  • Hello showy 

    Create two new columns in your date table:

    MonthReverse = FORMAT('Date'[Date], "MMM")

    MonthSortReverse = 13 - 'Date'[MonthSort]  -- If Jan = 1, Feb = 2...

    Then in that specific matrix

    Use MonthReverse for the column headers.

    Sort MonthReverse by MonthSortReverse.

    Thanks,
     Pankaj Namekar | LinkedIn

    If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

  • Hi showy,

     

    Thank you for reaching out to Microsoft Fabric Community.

     

    Since the matrix ranges multiple years so just sorting by month may not work. Please follow below steps:

    • In your date table create a new column:
      YearMonth = FORMAT('Date'[Date], "MMM yyyy")
    • Then create a reverse sorting column:
      YearMonthSortReverse = 100000 - (YEAR('Date'[Date]) * 100 + MONTH('Date'[Date]))
    • In the matrix visual use YearMonth in the column headers and sort YearMonth by YearMonthSortReverse.

    This will sort the columns in reverse order for all months and years.

     

    If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" โ€“ Iโ€™d truly appreciate it! 

     

    Thanks and regards,

    Anjan Kumar Chippa

5 Replies

  • Hello showy 

    Create two new columns in your date table:

    MonthReverse = FORMAT('Date'[Date], "MMM")

    MonthSortReverse = 13 - 'Date'[MonthSort]  -- If Jan = 1, Feb = 2...

    Then in that specific matrix

    Use MonthReverse for the column headers.

    Sort MonthReverse by MonthSortReverse.

    Thanks,
     Pankaj Namekar | LinkedIn

    If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

    • showy's avatar
      showy
      Icon for Helper II rankHelper II

      Hi pankajnamekar25

      i tried this but i saw that i need also the year information because the matrixrange will be over multiple year. How would you solve this? 
      So the matrix schould start with May 25, Apr 25, Mar 25, Feb 25, Jan 25, Dez 24 .... Jan 24

  • v-achippa's avatar
    v-achippa
    Icon for Community Support rankCommunity Support

    Hi showy,

     

    Thank you for reaching out to Microsoft Fabric Community.

     

    Since the matrix ranges multiple years so just sorting by month may not work. Please follow below steps:

    • In your date table create a new column:
      YearMonth = FORMAT('Date'[Date], "MMM yyyy")
    • Then create a reverse sorting column:
      YearMonthSortReverse = 100000 - (YEAR('Date'[Date]) * 100 + MONTH('Date'[Date]))
    • In the matrix visual use YearMonth in the column headers and sort YearMonth by YearMonthSortReverse.

    This will sort the columns in reverse order for all months and years.

     

    If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" โ€“ Iโ€™d truly appreciate it! 

     

    Thanks and regards,

    Anjan Kumar Chippa

    • showy's avatar
      showy
      Icon for Helper II rankHelper II

      Thanks that worked perfectly๐Ÿ˜€

  • showy Add the month column to the matrix visual.
    Sort the month column by the MonthSort column in descending order.