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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Split 1 row into multiple rows on hourly basis of datetime column in power bi

I have below dataset which include start and end time as mentioned below table.

IDStart Date    End Date
abc01-02-2021 08:0001-02-2021 11:00
xyz01-02-2021 08:0001-02-2021 10:00

 


I want to split this into different hours such that one row contains only one hour of data. This is the dataframe I want to get.

IDStart Date    End Date
abc01-02-2021 08:0001-02-2021 09:00
abc01-02-2021 09:0001-02-2021 10:00
abc01-02-2021 10:0001-02-2021 11:00
xyz01-02-2021 08:0001-02-2021 09:00
xyz01-02-2021 09:0001-02-2021 10:00

 

Need Help

 

Community Support Team

 

Thanks in advance

 

 

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

pls try code in power query

Screenshot_1.png

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Its working thanks

Anonymous
Not applicable

Hi @Anonymous 

 

This is the table I created

vjialongymsft_0-1704434897348.png

 

 

Click transform data in power bi desktop

 

Use the following code to add a custom column

 

let

    StartDate = [Start Date],

    EndDate = [End Date],

    HourList = List.Transform({0..Duration.TotalHours(EndDate - StartDate)-1}, each StartDate + #duration(0, _, 0, 0))

in

    HourList

 

 

This is the result

vjialongymsft_1-1704434897350.png

 

 

Expand the custom column

 

vjialongymsft_2-1704434926965.png

 

 

Use the following code to add a custom column again as the end date

 

[Custom] + #duration(0, 1, 0, 0)

 

This is the result

vjialongymsft_3-1704434926968.png

 

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ahmedx
Super User
Super User

pls try code in power query

Screenshot_1.png

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors