Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Add dynamical incremental column for filtered data

Good day,   I have a report with slicers and also with filters applied on the visual. I need to add an incremental column with values from 1 to count(number or rows displayed). This range needs to ...
  • MFelix's avatar
    MFelix
    5 years ago

    Hi Anonymous ,

     

    I will post the answer here so you can accept and hel others.

     

    Add the following measure and change your Row Number to the code below:

     

    ID_SUM_Group =
    SUMX ( MyTable, SUM ( MyTable[Index] ) )

     

    Since there can be more than one index on your context for the table visualization you need to do the following Row Code:

    Row_Number =
    VAR Row_Number_Filter = [ID_SUM_Group]
    VAR temp_table =
        SUMMARIZE (
            ALLSELECTED ( MyTable),
            MyTable[Column1],
            MyTable[Column2],
            MyTable[column3],
            ...,
            MyTable[ColumnN],
            "Row_number", [ID_SUM_Group]
        )
    RETURN
        COUNTROWS ( FILTER ( temp_table, [Row_number] <= Row_Number_Filter ) )

     

    In the summarize function you need to place all the columns you have on the table visualization giving context, be aware that you may not need all of the columns so in some cases you can have a shorter summarize function since so of the columns aren't needed example if you have a ID and ID description you can only use the ID since they both relate to the same information.