Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi Everyone,
My requirement is to create a new identifier column based on the combination of the two existing columns.
For Example, Let us consider this to be the Sample data. We need to create this ID (First column) based on the combination of "Country & PG" column.
ID | Country | PG | Area | Action |
1 | C1 | P1 | A1 | TRUE |
2 | C1 | P1 | A2 | FALSE |
1 | C1 | P2 | A1 | TRUE |
2 | C1 | P2 | A2 | TRUE |
3 | C1 | P2 | A3 | FALSE |
1 | C1 | P3 | A1 | TRUE |
1 | C2 | P1 | A1 | TRUE |
2 | C2 | P1 | A2 | FALSE |
We need to increment the ID, if the combination of the Country and PG is same. If one of them seems to change, then again we need to start from the index 1. Can anyone please help me in implementing this ID column. It would be really helpful If you could able to give me the solution file or M code.
Thanks in advance!!
Solved! Go to Solution.
@Anonymous , First add index column in power query and then try a new column in dax
ID=
countx(filter(Table, [Country] =earlier([country]) && [PG] =earlier([PG]) && [index] <=earlier([index]) ), [index])
https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi
@Anonymous , First add index column in power query and then try a new column in dax
ID=
countx(filter(Table, [Country] =earlier([country]) && [PG] =earlier([PG]) && [index] <=earlier([index]) ), [index])
https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.