cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

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

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Power Query date time serial number

Hi @Tiemen 

 

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
Highlighted
Super User IV
Super User IV

Re: Power Query date time serial number

Hi @Tiemen 

 

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

Helper II
Helper II

Re: Power Query date time serial number

Hi @Mariusz 

 

This works!! Thank you!! 🙂

 

Kind regards,

Tiemen

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.

Top Kudoed Authors