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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
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
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 56 | |
| 52 | |
| 45 | |
| 17 | |
| 16 |
| User | Count |
|---|---|
| 108 | |
| 108 | |
| 39 | |
| 33 | |
| 25 |