fbpx

Learn How to Create Index Column Using Power Query

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.

BEFORE ADDING INDEX COLUMN

Power BI For Dummies

FREE ENROLLMENT

POWER BI FOR DUMMIES

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

POWER QUERY FOR EXCEL & POWER BI COURSE
• Course Certificate • Lifetime Access & Free Updates • Lifetime Time Support • Career Focused

 

Note: You can also select the custom option instead of ‘From 1’ and set the index range of your choice.

ADD INDEX COLUMN

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 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

MOVE COLUMN TO THE 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.

 INDEX COLUMN MOVED TO THE BEGINNING

To get in-depth knowledge of Power Query in Excel and Power BI, then check out our latest Power Query Course with Certification. In this course, you will learn data cleaning and data transformation techniques that help to organize the data in excel and Power BI.

You can gain more knowledge :