There is one more interesting feature of Power Query where it lets you add an index column that serves as a row counter to your data.
Power Query Helps To Create Index Column
Let’s go through the steps in detail with an example. Our sample data consists of Months and revenue data as shown in the picture below. Here, we want a column that counts from 1 to 12 next to our data to serve as our row numbers.
Step 1: Add Index Column
After you load your data into the Power Query Editor, follow the below process to add an Index column to your data.
Add Column > Index Column > From 1
Note: You can also select the custom option instead of ‘From 1’ and set the index range of your choice.
Step 2: Select the Index Column
As you know we always prefer the index at the beginning of the data. But after adding the Index column, it is placed at the end in Power Query as shown in the below picture. To move it to the beginning, we have to select the Index column first.
Step 3: Move Index Column to the Beginning
After selecting the Index column, move it to the beginning by performing the below step.
Transform > Move > To Beginning
Step 4: Close and Apply
After you move the Index column to the beginning of the data table in Power Query Editor as shown below, close and apply the changes for further transformations.