Forum Discussion
tskumar
1 year agoRegular Visitor
Power Query automatically converting total hours into datetime format, hence Tot_Hrs are incorrect
I have data with total hours column but when i'm importing the data into power query automatically getting converted to datetime format and getting the sum of hours incorrect. Although I have disabl...
ZhangKun
1 year agoSuper User
Even without using type inference, Power Query still thinks it is a date type.
Note: The two columns following time(hrs) are the equivalent dates and numbers in Excel.
If you convert time(Hrs) directly to a number, you will find that the result is wrong (one more day), this is because of the bug in the leap year of 1900.
The correct way is to use the date difference to determine the number of days (Excel uses days to determine the date).
code:
Duration.TotalDays([#"time(Hrs)"] - #datetime(1899,12,31,0,0,0))