Using a Power Query, you can add an Index column to your data that serves as a row counter to rows in data table, that mean 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 appear > Select your dataset > Add Column > Index Column
Step-3: Index column gives you three option 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
Add Index Column dialogue box appears, here we have provided index starting 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.
Will adding an index in power query and ordering it by index in ascending order there ensure that the same order will be maintained in the data view as well in Power BI?