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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
azakir
Resolver I
Resolver I

Time keeps changing to datetime in Power Query

Hi Guys. 

Got a weird one here. We have an excel file on web which we ingest to Power BI. I did a report which was working fine till past few days. Apparently there is a "Time at Site" column in excel spreadsheet which shows the total time spent: 

 

azakir_0-1655371915316.png

However, when I pull this sheet in Power BI, it keeps changing the field to datetime and even the values are bit out of whack: 

 

azakir_1-1655371955018.png

Even in Power Query,: 

azakir_2-1655371994425.png

Any idea how I can only get just the time. 

P.S. this was working fine till day before yesterday. 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @azakir 

 

It seems Power BI will detect the data types in Excel and import data with these data types directly. To get just time values, select this column, select Transform > Time > Time Only

vjingzhang_0-1655879697318.png

 

Apply this change to data model. Then in Power BI Desktop, change the format of this column to "hh:nn:ss". 

vjingzhang_1-1655880408069.png

 

Date and Time in Excel are stored as numbers. This enables a user to use these dates and time in calculations. So another workaround is to change this column's number format to General or Number in Excel first. This will convert these time values into decimal numbers. Then import data into Power BI. In Power Query Editor, change this column's data type to Time. This will convert them back to Time values. 

 

Hope this helps. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

10 REPLIES 10
v-jingzhang
Community Support
Community Support

Hi @azakir 

 

It seems Power BI will detect the data types in Excel and import data with these data types directly. To get just time values, select this column, select Transform > Time > Time Only

vjingzhang_0-1655879697318.png

 

Apply this change to data model. Then in Power BI Desktop, change the format of this column to "hh:nn:ss". 

vjingzhang_1-1655880408069.png

 

Date and Time in Excel are stored as numbers. This enables a user to use these dates and time in calculations. So another workaround is to change this column's number format to General or Number in Excel first. This will convert these time values into decimal numbers. Then import data into Power BI. In Power Query Editor, change this column's data type to Time. This will convert them back to Time values. 

 

Hope this helps. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Thank you, I had the same problem. Changing to "Time Only" in power query worked for me. Then after I hit "Close and Load" I changed the time format back to "h:mm" in excel and that worked. I was afraid that if power query changed it to a clock time, it would not change back correctly to just a total time when I selected "h:mm" in excel, but thankfully it worked.

Hi @v-jingzhang 

Thank you so much for your help. Changing the column to General in excel and then pulling it in the report and changing the data type did the trick for me. 

HotChilli
Super User
Super User

Maybe you can post a small sample excel file on 3rd party site and put the link here. I'll try and import it and see what happens

HotChilli
Super User
Super User

Ah, so it should really be duration type?

That's correct. Should be duration type. 

HotChilli
Super User
Super User

And the manual change to Time works?  Sometimes Excel column data types are persistent when imported to Powerbi.  Is this column immediately assigned a datetime without an explicit type assignment in the early  query steps?  

Most sources are imported as text before powerbi attempts to identify the datatypes.  Excel seems to be a bit different.  So i suppose it's possible somebody changed the properties in Excel.

@HotChilli The manual changes to time keep on throwing the following error if changed to Text:

azakir_1-1655419837076.png

 

The original column in excel spreadsheet should be the time spent at site for example, 12:30:36 basically is time spent at site is 12 hours, 30 minutes and 36 seconds. But Power BI treats it as 12:30:36 PM and throws in a date as well. If I change this to Time, it shows 12:30:36 PM which is also incorrect: 

azakir_0-1655419819430.png

not sure if it has to do with properties in excel, possibly could be. 

azakir
Resolver I
Resolver I

Hi @HotChilli thanks for your reply. 

Had a look in power query and the nothing in there that changes it to datetime. The highlighted one below is something I did manually to change it time: 

azakir_0-1655418561995.png

 

HotChilli
Super User
Super User

Look at the steps in power query.  One of them should be called Changed Type or similar.  Look for the column name and edit the type it gets changed to.  Should be time instead of datetime.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.