Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

change generateseries order

I have this dax code

 

var ....

 

Return

UNION(ROW(Value,1), Row(Value,2),
GENERATESERIES( Last5Years, SelectedYear, 1) ,
SUMMARIZECOLUMNS(Cost Season Code))
 
That create this table
Name20182019202020212022
A18853
B26235
C33346

 

but user want the table by Year descending, like this

 

Name20222021202020192018
A35881
B53262
C64333

 

Which dax function i need to do to change the order of the series 

 

Thanks

Javier

2 Replies

  • Anonymous , I have a video on this, You need to create a desc rank on year and use that

    New columns

    Year1 = [Year]

    Year Rank = Rankx(all(Table), [Year],,desc, dense)

     

    Mark Year Rank as sort column of Year and use Year 1 as a column in the matrix

     

    My Video : https://youtu.be/KK1zu4MBb-c

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi amit

       

      The problem is the data is generated in the fly by dax. This is reason I can't applied you example:

       I need to include desc order here.

       

      Return

      UNION(ROW(Value,1), Row(Value,2),
      GENERATESERIES( Last5Years, SelectedYear, 1) ,
      SUMMARIZECOLUMNS(Cost Season Code))
       
      Thanks for your help
      Javier