Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Add row number to Filtered table

Hello,

I need to add to my table view a row_number column which needs to reset based on the selection. For example, if I select the territory Canada, I need to have row_numbe from 1 to 100 let's say, if I change the selection to US  I need to have 1 to 50.

 

I have tried the solution from the community with adding an index and creating a measure: 

Row_Number =
CALCULATE (
COUNTROWS(table),
FILTER ( ALLSELECTED (table ), table[Index] <= MAX ( table[Index]) )
) but the result is not the desired one ( I get 4, 8, 11, 14...). I have also filters applied in the Filter Pane from the right..

 

Thank you.

5 Replies