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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
JamesMidgley
Advocate I
Advocate I

Imported Time based Data via Excel. Query Editor has presented same data as Date Time

I have imported Time based data from Excel.  In Query Editor the data that in Excel reads 00:07:45 to show a duration of 7hrs and 45 mins is now 31/12/1899 00:07:45.

 

First question is why has the Query editor changed the format from Time (as specified in Excel) to DateTime in the Query Editor and stuck a ridiculous date on the front?

 

Second question is related to data type.  My values are durations.  I have attempted to change the data type to Duration but the Query Editor returns an error.  How do I get around this with the minimum of faffing?

1 ACCEPTED SOLUTION

It looks strange to me that 00:07:45 would convert to 7 hours and 45 minutes and not to 7 minutes 45 seconds.

 

Anyhow, this works with me:

 

let
    Source = Excel.Workbook(File.Contents("C:\Users\Marcel\Documents\Forum bijdragen\Power BI Community\Import time from Excel.xlsx"), null, true),
    Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Table1_Table,{{"Duration", type datetime}}),
    #"Extracted Date" = Table.TransformColumns(#"Changed Type",{{"Duration", each _ - #datetime(1899,12,31,0,0,0), type duration}})
in
    #"Extracted Date"

 

 

Coincidentally I published a video some time ago about durations in Excel and Power Query / Power BI:

Specializing in Power Query Formula Language (M)

View solution in original post

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@JamesMidgley,

 

You may change the format to Number in Excel.

https://support.office.com/en-us/article/Format-numbers-f27f865b-2dc5-4970-b289-5286be8b994a

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.

@v-chuncz-msft

 

Thanks for the insight but I fail to see how this can help me.  Changing the cell format to number converts 00:07:45 which represents 7 hours and 45 minutes to to 0.32.  Ideally I do not want to do any data processing in Excel as I'd like to keep the source clean and do any manipulations in Power BI so that they are automated and repeatable. Any additional guidance would be appreciated

It looks strange to me that 00:07:45 would convert to 7 hours and 45 minutes and not to 7 minutes 45 seconds.

 

Anyhow, this works with me:

 

let
    Source = Excel.Workbook(File.Contents("C:\Users\Marcel\Documents\Forum bijdragen\Power BI Community\Import time from Excel.xlsx"), null, true),
    Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Table1_Table,{{"Duration", type datetime}}),
    #"Extracted Date" = Table.TransformColumns(#"Changed Type",{{"Duration", each _ - #datetime(1899,12,31,0,0,0), type duration}})
in
    #"Extracted Date"

 

 

Coincidentally I published a video some time ago about durations in Excel and Power Query / Power BI:

Specializing in Power Query Formula Language (M)

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.