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
ShmuelM just make sure before adding the index/row number (explained in the post above) you order your dataset by the reference column (in your case Position)
- ShmuelM9 years agoAdvocate II
Hi sbvsv ,
Thanks for answering ,
I saw this solution but this is not answering my question .
for example I have this this table, 2 columns :ID , CITY in the phisic table:
ID , CITY
1 WASHINGTON
2 AMSTERDAM
3 LONDON
4 ROMA
IF I will select and filter in the report only 3 cities : WASHINGTON , AMSTERDAM , ROMA
The Table In PowerBI will show me
1 WASHINGTON
2 AMSTERDAM
4 ROMA.
I want to see it like this:
1 WASHINGTON
2 AMSTERDAM
3 ROMA .
I don't want the 'ID' Of the row , just a running number in the display table in Power BI that will change every time I chage filter / order.
I hope the question is clearer.
- MFelix9 years agoSuper User
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
- hmedinaa9 years agoFrequent Visitor
Very helpfully
Thanks