Forum Discussion

fb198's avatar
fb198
Regular Visitor
2 years ago
Solved

Month name not sorting correctly despite Sorting by another column

Hi, 

 

I have a column in my Calendar Table with values like 'Jan 2024', 'Feb 2024', 'Mar 2024' and so on. I have sorted with a Custom Index called Sort_Index. Despite Sorting it by another column. It sorts correctly in table or visual chart. However, when I use a card at report level to get the month of reporting selected, The 'First' value is shown as April.

 

Every other post I have found dealing with this issue had had answers about the 'sort-by-column' feature. However, as you can see I've already applied that, but seem to recieve the same results. 

Values of MonYear and Sort_Index

 

 

 

 

Any help to work with/around this is highly appreciated. 

 

  • Hi fb198 - as per my understanding card visual doesn't respect the custom sort order applied to your month column. Even though you've already sorted your MonYear column using the Sort_Index column, the card visual might still be picking the first value alphabetically instead of following the custom sort order.

    create a measure to get the card visual as per monthname order instead of alphabitical 

     

    Selected Month =
    CALCULATE(
        FIRSTNONBLANK('DateTab'[MonthYear], 1),
        FILTER(
            'Datetab',
            'DateTab'[MonthNumber] = MINX(ALL('Datetab'), 'DateTab'[MonthNumber])
        )
    )
     
    In above measure i have month number to sort it , in your case you can change it to sortindex column or monthnumber also fine.
     
    Hope it works.

     

     

1 Reply

  • Hi fb198 - as per my understanding card visual doesn't respect the custom sort order applied to your month column. Even though you've already sorted your MonYear column using the Sort_Index column, the card visual might still be picking the first value alphabetically instead of following the custom sort order.

    create a measure to get the card visual as per monthname order instead of alphabitical 

     

    Selected Month =
    CALCULATE(
        FIRSTNONBLANK('DateTab'[MonthYear], 1),
        FILTER(
            'Datetab',
            'DateTab'[MonthNumber] = MINX(ALL('Datetab'), 'DateTab'[MonthNumber])
        )
    )
     
    In above measure i have month number to sort it , in your case you can change it to sortindex column or monthnumber also fine.
     
    Hope it works.