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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
StephenF
Responsive Resident
Responsive Resident

How to insert index into a column of type table for each table

I wish to have an index of 1,2,3,4 etc into row of type table. So each table in each row gets its own index

 

I think its something like this 

Table.AddIndexColumn(
[SortSubTable], "Rank", 1,1)

But how would that look exactly within advanced editor?

1 ACCEPTED SOLUTION

What matters is your previous step and All Data. Your step in AE would become

#"Added Custom" = Table.AddColumn(#"Your previous step", "Custom", each Table.AddIndexColumn([All Data], "Rank", 1,1))

 Better to insert a custom column and put following formula there which will take care of your previous step as well

= Table.AddIndexColumn([All Data], "Rank", 1,1)

View solution in original post

4 REPLIES 4
Vijay_A_Verma
Super User
Super User

Better to insert a custom column and put this formula there. This would like following in AE

#"Added Custom" = Table.AddColumn(#"Your previous step", "Custom", each Table.AddIndexColumn([SortSubTable], "Rank", 1,1))

What refers to the column of type Table in your example? In my data I call my tables "CatChanges" and the Table column within it is called "All Data".

What matters is your previous step and All Data. Your step in AE would become

#"Added Custom" = Table.AddColumn(#"Your previous step", "Custom", each Table.AddIndexColumn([All Data], "Rank", 1,1))

 Better to insert a custom column and put following formula there which will take care of your previous step as well

= Table.AddIndexColumn([All Data], "Rank", 1,1)

You need to put the column to be ranked on in the first column bizzarely also or it wont sort in the correct order.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.