Forum Discussion
Anonymous
5 years agoNot applicable
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
| Name | 2018 | 2019 | 2020 | 2021 | 2022 |
| A | 1 | 8 | 8 | 5 | 3 |
| B | 2 | 6 | 2 | 3 | 5 |
| C | 3 | 3 | 3 | 4 | 6 |
but user want the table by Year descending, like this
| Name | 2022 | 2021 | 2020 | 2019 | 2018 |
| A | 3 | 5 | 8 | 8 | 1 |
| B | 5 | 3 | 2 | 6 | 2 |
| C | 6 | 4 | 3 | 3 | 3 |
Which dax function i need to do to change the order of the series
Thanks
Javier
2 Replies
- amitchandakSuper User
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
- AnonymousNot 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 helpJavier