Forum Discussion
How to add a Serial Row Number Column in Power BI Table / Matrix visual?
- 9 years ago
Hi ShmuelM,
Grabbing in your table just add a measure with the countrows:
Row_Number = CALCULATE ( COUNTROWS(Profit_Table), FILTER ( ALLSELECTED ( Profit_Table ), Profit_Table[Position] <= MAX ( Profit_Table[Position]) ) )As you can see in the print below it counts the number of rows no matter if you have slicer or not, left table is the full data, right table is influenced by slicer.
Please be aware that this measure is influenced by the order of your Position so if you want to order by another column this will give you the row number in a different order also.
Regards,
MFelix
Hi ShmuelM,
Grabbing in your table just add a measure with the countrows:
Row_Number =
CALCULATE (
COUNTROWS(Profit_Table),
FILTER ( ALLSELECTED ( Profit_Table ), Profit_Table[Position] <= MAX ( Profit_Table[Position]) )
)As you can see in the print below it counts the number of rows no matter if you have slicer or not, left table is the full data, right table is influenced by slicer.
Please be aware that this measure is influenced by the order of your Position so if you want to order by another column this will give you the row number in a different order also.
Regards,
MFelix
This doesn't seem to work with a matrix...any clue as to why?
- MFelix4 years agoSuper User
Hi Anonymous ,
This depends on the context can you share some mockup data?
- Anonymous4 years agoNot applicable
Sure!
So I have the following Matrix:I need to add one row, at the beggining of the matrix, with the row number: 1,2,3,4,5,6 .....
I have tried it your way and it just gives random numbers that i can't include in the matri. The closest I have been to achieving my goal was this expression:Row_Number =RANKX(ALL(v_inf_ttv_alertas_campanas_dia[ds_campania]),[Sumatorio])However, I can only add the column as a value, wich obviously doesn't do what I want.- MFelix4 years agoSuper User
Hi Anonymous ,
Has you refer you cannot add a measure except on the values part of your matrix, meaning that you cannot use it in the rows.
In order to do this maybe you can use a disconnected table with the order and then make a measure using the ranking and the disconnected table, one question is your ranking based on the total value of the matrix? so the last column that refers to the total GRP20?