Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello,
I have a table that looks like this.
ID | DateTime |
1 | 3-2-2020 08:00:38 |
1 | 3-2-2020 08:01:16 |
1 | 3-2-2020 08:01:23 |
2 | 3-2-2020 08:02:04 |
2 | 3-2-2020 08:04:43 |
3 | 3-2-2020 08:02:09 |
3 | 3-2-2020 08:02:11 |
3 | 3-2-2020 08:03:47 |
3 | 3-2-2020 08:04:36 |
I would like to add a column with increasing numbers per ID based on the date and time column. Below an example of the desired result.
ID | DateTime | Serialnr |
1 | 3-2-2020 08:00:38 | 1 |
1 | 3-2-2020 08:01:16 | 2 |
1 | 3-2-2020 08:01:23 | 3 |
2 | 3-2-2020 08:02:04 | 1 |
2 | 3-2-2020 08:04:43 | 2 |
3 | 3-2-2020 08:02:09 | 1 |
3 | 3-2-2020 08:02:11 | 2 |
3 | 3-2-2020 08:03:47 | 3 |
3 | 3-2-2020 08:04:36 | 4 |
Is this possible with the help of power query and can someone help me with the right code? @Greg_Deckler @MattAllington
Thanks in advance!!
Kind regards,
Tiemen
Solved! Go to Solution.
Hi @Anonymous
You can use Group By on ID, All Rows as Operation
And later adjust the Grouped Rows Step to accommodate Index column.
= Table.Group(#"Changed Type", {"ID"}, {{"tbl", each Table.AddIndexColumn( _, "Serialnr", 1, 1 ) , type table [DateTime=datetime, Serialnr=number]}})
Please see the attached file for reference.
Hi @Anonymous
You can use Group By on ID, All Rows as Operation
And later adjust the Grouped Rows Step to accommodate Index column.
= Table.Group(#"Changed Type", {"ID"}, {{"tbl", each Table.AddIndexColumn( _, "Serialnr", 1, 1 ) , type table [DateTime=datetime, Serialnr=number]}})
Please see the attached file for reference.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.