Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
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
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 84 | |
| 49 | |
| 38 | |
| 31 | |
| 30 |