Forum Discussion

ForgotID's avatar
ForgotID
Advocate I
11 months ago
Solved

How to order the months while using CONCATENETX

Hello All,

 

I am trying to show multiple selected value in a card by using the following DAX.

FSC_Periods = CALCULATE( CONCATENATEX(DISTINCT(Metrics[FSC_PERIOD_NAME]),Metrics[FSC_PERIOD_NAME],", ",Metrics[FSC_PERIOD_NAME]))
 
It works fine but the order of the output is either ascending or descending not in the calendar order.
For example if I selected JUL, AUG, SEP then it returns AUG, JUL, SEP whereas I want to show as JUL, AUG, SEP.
 
Is it even possible? Thanks

4 Replies

  • ForgotID  It sounds like you need to sort your FSC_PERIOD_NAME by the Date column within your table, which should also be sorted.

  • hI ForgotID 

     

    CONCATENATEX has an optional order by parameter. Ensure that your table has such a column.

    FSC_Periods =
    CALCULATE (
        CONCATENATEX (
            DISTINCT ( Metrics[FSC_PERIOD_NAME] ),
            Metrics[FSC_PERIOD_NAME],
            ", ",
            CALCULATE ( SELECTEDVALUE ( Metrics[FSC_PERIOD_NAME_SORT] ) ) -- custom sort-by column in your table
        )
    )
    

     

    • ForgotID's avatar
      ForgotID
      Advocate I

      It worked. Thank you. Accepting it as solution!