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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Create DateTime List between start datetime & end DateTime

Hello

 

I hope someone can help?

 

I want to create a list of datetimes between a Start DateTime column and an End DateTime column in Power Query with  1 hour between . I have tried this but it didn't work using add Custom Column

 = List.DateTimes([#"Shift Start Time"], [#"Shift End Time"], #duration(0,1,0,0))

 

Example

 

Table currently looks like this

Start DateTime                             End DateTime     

01/01/2020 00:00:00                     01/01/2020 04:00:00

 

i want it to look like this 

 

Start DateTime                             End DateTime                               Custom

01/01/2020 00:00:00                     01/01/2020 04:00:00                    01/01/2020 00:00:00 

01/01/2020 00:00:00                     01/01/2020 04:00:00                    01/01/2020 01:00:00 

01/01/2020 00:00:00                     01/01/2020 04:00:00                    01/01/2020 02:00:00 

01/01/2020 00:00:00                     01/01/2020 04:00:00                    01/01/2020 03:00:00 

01/01/2020 00:00:00                     01/01/2020 04:00:00                    01/01/2020 04:00:00 

 

I have nearly no experience with M so it I would be grateful if I could get a statement to use to create a custom column

 

Thanks

Joe 

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Anonymous 

 

You may use code below to add a custom column.

List.DateTimes([Start DateTime], Duration.Hours([End DateTime] - [Start DateTime]) + 1, #duration(0,1,0,0))

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@Anonymous 

 

You may use code below to add a custom column.

List.DateTimes([Start DateTime], Duration.Hours([End DateTime] - [Start DateTime]) + 1, #duration(0,1,0,0))

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Can you fix this so that it always end with the End Date and Time and the hours inbetweena are rounded to the end of the hour?

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors