Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Create a numbered column in a DAX created table

Hello all,  I have created a new table (with only 1 column) from DAX to showcase the week numbers for my charts, however, when I add them to charts they do not go in ascending order. I try sort by...
  • jdbuchanan71's avatar
    2 years ago

    As part of your table DAX code you could add a sorting column, something like this.

    Dimensioni FINYEARWEEK = 
    VAR Table1 =
        DISTINCT ( 'Toll People Labour'[FinYearWeek] )
    VAR Table2 =
        DISTINCT ( 'AUS Casuals'[FinYearWeek] )
    RETURN
        ADDCOLUMNS (
            DISTINCT ( UNION ( Table1, Table2 ) ),
            "Sort", VALUE ( MID ( [FinYearWeek], 3, 2 ) ) * 100 + VALUE ( RIGHT ( [FinYearWeek], 2 ) )
        )