Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago

Adding a row number to a table visual

I need to add a row number to one of my table visuals. The table doesn't have unique values so I created an index. I'm using the index for the row number. Unfortunalely when I filter the table visual on the Year the column with the index is filtered as well so it doesn't start with row 1. Below is what is coming out in the table visual. Is there a way to define a row number so it always starts with a row #1.

 

6 Replies

  • Anonymous Create a new calculated column using the following DAX formula:

         RowNumber = RANKX(ALLSELECTED('YourTable'), 'YourTable'[Index], , ASC, DENSE)
     
    Go to the Report view.
    Add the new RowNumber column to your table visual.
    • Anonymous's avatar
      Anonymous
      Not applicable
      This is what I have done.The first statement is what is in Power Query and the Standards table is sorted by Stand column. Unfortunaly the table visual still doesn't start with RowNumber 1. It's sorted by RowNumber.
      = Table.AddIndexColumn(#"Sorted Rows", "Index", 1, 1, Int64.Type)
      RowNumber = RANKX(ALLSELECTED('Standard'), 'Standard'[Index], , ASC, DENSE)
       

       

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi Anonymous ,
    Try this maybe:
    Row Number =
    RANKX(
    ALLSELECTED('YourTable'[Index]),
    'YourTable'[Index],
    ,
    ASC,
    DENSE
    )
    Hope this helps!
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi Anonymous ,
    Just wanted to check if you had the opportunity to review the suggestion provided?
    If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank You

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi @U156531 ,
    Just wanted to check if you had the opportunity to review the suggestion provided?
    If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank You

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi @U156531 ,
    Just wanted to check if you had the opportunity to review the suggestion provided?
    If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank You