Power BI: How to Add Index Column to Table


You can use the Index Column feature from the Power Query Editor in Power BI to quickly add an index column to a table.

The following example shows how to do so in practice.

Example: How to Create Table from Another Table Using DAX

Suppose we have the following table in Power BI named my_data:

Suppose that we would like to add an index column that ranges from 1 to n.

To do so, click the Home tab along the top ribbon, then click the Transform data icon:

This will bring up the Power Query Editor.

Next, click the Add Column tab, then click the dropdown arrow next to Index Column and choose whether or not you’d like the index values to start at 0 or 1:

Power BI add index column

We’ll click From 1 so that the following index column is added:

Once you exit out of the Power Query Editor, a message box will appear that asks if you’d like to apply your changes.

Once you click Yes, the index column will be added to the table:

Notice that the values in the new index column range from 1 to 11.

Additional Resources

The following tutorials explain how to perform other common tasks in Power BI:

How to Count Number of Occurrences in Power BI
How to Write an IF Statement in Power BI
How to Write an IF Statement with Multiple Conditions in Power BI

Leave a Reply

Your email address will not be published. Required fields are marked *