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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Power Query date time serial number

Hello,

 

I have a table that looks like this.

IDDateTime
13-2-2020 08:00:38
13-2-2020 08:01:16
13-2-2020 08:01:23
23-2-2020 08:02:04
23-2-2020 08:04:43
33-2-2020 08:02:09
33-2-2020 08:02:11
33-2-2020 08:03:47
33-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.

 

IDDateTimeSerialnr
13-2-2020 08:00:381
13-2-2020 08:01:162
13-2-2020 08:01:233
23-2-2020 08:02:041
23-2-2020 08:04:432
33-2-2020 08:02:091
33-2-2020 08:02:112
33-2-2020 08:03:473
33-2-2020 08:04:364

 

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

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can use Group By on ID, All Rows as Operation 
image.png

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.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

2 REPLIES 2
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can use Group By on ID, All Rows as Operation 
image.png

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.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Anonymous
Not applicable

Hi @Mariusz 

 

This works!! Thank you!! 🙂

 

Kind regards,

Tiemen

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors