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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors