Using Power Query, you can add an Index column to your data that serves as a row counter for the rows in the data table. This means you can add a Serial Number or Row Number column in Power BI.
Note: It does not support Direct Query mode.
Let’s get started-
Follow these steps in order to create an Index column-
Step-1: Under Home Tab > Click on Transform data > Select Transform data
Step-2: Power Query Editor windows appears > Select your dataset > Add Column > Index Column
Step-3: The index column provides you with three options as follows:
- From 0 – It adds index starting from 0.
- From 1 – It adds index starting from 1.
- Custom – It gives you ability to set index starting number and increment.
Start Index From 0 & From 1
Click on Add column > Index Column > choose ‘From 0’ or ‘From 1’
Click on “Add Column” > “Index Column” > choose “Custom Index.”
The “Add Index Column” dialogue box appears. Here, we have provided the starting index number as 1 and want it to be incremented by 2.
That means each next rows will have an index number that is incremented by 2 to the index number of previous row.
See the final output
How to move new created Index column to the beginning?
Select the column > click on Transform Tab > Click on Move Icon > Choose To Beginning.
You can also move multi column together, select multiple column to using Ctrl + Click.
Refer Power BI other post: Power BI tutorials
Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome or you can leave us message on our Contact form , we will revert to you asap.