Forum Discussion

luccaguimaraes's avatar
luccaguimaraes
Frequent Visitor
4 years ago
Solved

How to create a Row Column in DAX

Hi,   I need to create a column that contains the row number, exactly like the red numbers on the print below:   *It has to be on DAX because It is a calculated table from M code *It will always...
  • mahoneypat's avatar
    4 years ago

    Here is one way to do it with DAX (without RANKX). Just create a DAX table with the expression below.

     

    MonthTable =
    VAR fourmonthsago =
    EOMONTH( TODAY(), -4 )
    VAR monthdates =
    ADDCOLUMNS(
    GENERATESERIES( 1, 4, 1 ),
    "Mes/Ano", FORMAT( EOMONTH( fourmonthsago, [Value] ), "mmm/yy" )
    )
    RETURN
    monthdates

     

    Pat