Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
AlessandroBet
Helper V
Helper V

Column index

Hi,

 

i need to insert a column index matching the value of other column

 

Ex:

 

Column to match --> Index

A                                   1

B                                   2

C                                   3

C                                   3

B                                   2

D                                  4

A                                  1

A                                  1

 

Many thanks

1 ACCEPTED SOLUTION

Hi @AlessandroBet - you can create a calculated column as like below:

 

rajendraongole1_0-1739182628497.png

Index1 =
VAR LookupTable = ADDCOLUMNS( DISTINCT('soert_org'[Column to match]), "@Index", RANKX( DISTINCT('soert_org'[Column to match]), 'soert_org'[Column to match], , ASC, DENSE ) )
RETURN LOOKUPVALUE( Soert_Org[Index], Soert_Org[Column to match], 'soert_org'[Column to match] )
 
Hope this works.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

8 REPLIES 8
AlessandroBet
Helper V
Helper V

thank you for your fast replay but i want add indesx with DAX code

Hi @AlessandroBet - you can create a calculated column as like below:

 

rajendraongole1_0-1739182628497.png

Index1 =
VAR LookupTable = ADDCOLUMNS( DISTINCT('soert_org'[Column to match]), "@Index", RANKX( DISTINCT('soert_org'[Column to match]), 'soert_org'[Column to match], , ASC, DENSE ) )
RETURN LOOKUPVALUE( Soert_Org[Index], Soert_Org[Column to match], 'soert_org'[Column to match] )
 
Hope this works.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





It blocks here --> RETURN LOOKUPVALUESoert_Org[Index]

you have to use a calculated column . 

 

sharing the pbix FYR.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





how can i attach the pbx file?

you can upload it in a google drive and share the link to download.

 

But i have attached pbix file with solution. can you please check and confirm





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





MFelix
Super User
Super User

Hi @AlessandroBet ,

 

Using Power Query you can use any of the solutions provided in the video below:

 

https://www.youtube.com/watch?v=_PBX3RPXxHw


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



rajendraongole1
Super User
Super User

Hi @AlessandroBet  - You can create an Index Column based on Unique Values using Power Query in Power BI.

 

Steps in Power Query
Open Power Query Editor (Transform Data).
Remove Duplicates on the column you want to match:
Select the column (e.g., Column to match).
Click Remove Duplicates (under Home tab).
Add an Index Column:
Go to Add Column → Click Index Column (Choose Start from 1).
Re-merge with Original Table:
Go to Home → Click Merge Queries.
Merge the original table with the deduplicated table using Column to match.
Expand the merged table to bring in the Index column.

output is at soert_org

rajendraongole1_0-1739182206163.png

 

 

Please find the attached pbix.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors