Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ShmuelM
Advocate I
Advocate I

How to add a Serial Row Number Column in Power BI Table / Matrix visual?

Hi is there a way to do that , just to add the row number that will regenerate every time the table changes? 

2017-07-10 13_36_44-First Report - Power BI Desktop.png

1 ACCEPTED SOLUTION

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.

 

count_rows.png

 

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

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

28 REPLIES 28
Anonymous
Not applicable

Hi @MFelix , thank you for the response, I will try to make it work myself and get back to you eith that example if I have any problems. Again, thank you so much!!!!

Save my day! Thanks!


@MFelix wrote:

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.

 

count_rows.png

 

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

 

 


Save my day! Thanks!

@Garridex 

 

Hi! I have a similar problem and just tried your formula and it is working fine for me as well! Thanks!

Just quick question, I would like to use the measure created in a graph, so that I plot my variable vs this counter we've created, but it is not working.

 

Any idea how to do this?

 

Thanks a lot in advance!

Hi! I have a similar problem and just tried your formula and it is working fine for me as well! Thanks!

Just quick question, I would like to use the measure created in a graph, so that I plot my variable vs this counter we've created, but it is not working.

 

Any idea how to do this?

 

Thanks a lot in advance!

Yi
Regular Visitor

I have a new challenge in this area. I have a table with Index, City, Street, Value1 and Value2. There are duplicated value in City and Street, but Value1 and Value2 are different. Like

Index   City    Street  Value1  Value2

1           A       123      D1        C1

2           A       123      D2        C2

3           A       456      D3        C3

4           A       456      D4       C4

5           B       131      D5        C5

I use a scatter to see the Value distribution and I also want to use a table to see how many City and Street couples when I change a filter by Value1

I have the problem to show the row number in table, it show like

RowNo  City   Street

2            A       123

4            A        456

5            B        131 

What I want is

RowNo  City  Street

1            A       123

2            A       456

3            B        131

Microsoft should have just added a on/off for row numbers for tables and matrix. I'm needing help with this exact same question. Has this been answered for you? 

Very helpfully

 

Thanks

 

Very helpfully

 

Thanks

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.