Forum Discussion
Convert hour format data to decimal
- Anonymous7 years ago
Hi Pmorg73
I see that the format for time taken as a long date and hence the formula gives different value.
Going through your file, assuming the time is shown in longdate format then I tweeked the formula
Time*24 = 'Table1'[[Time]] Time]*24 - 24By doing so I got the result the same as Time*24 done in excel and portedover.CheersCheenuSing
Hi Pmorg73
Can you please load sampledata , output expected to Google / One Drive and share the link here.
Cheers
CheenuSing
Excel sheet here with basic data. I thinned it down to two elements, with mutliple entries. I have made it anonimous so it should be good to go. My actaul data is several thousand entries from 2013 to now.
Our database spits out the time column as hours. Then in Power BI it makes it a long date format (orignal image). In excel I would add a column and simply =Time *24 and get the decimal version. This is what I need to do in Power BI
I have seen people discussing going the other way around on here (ie decimal to time format)
- Anonymous7 years agoNot applicable
Hi Pmorg73
Have you tried createing a calculated column
DecimalHours = Table[Time] * 24
replace Table by your tablename
Cheers
CheenuSing
- Pmorg737 years agoPost Patron
Yeah i tried that before I posted the query on here, but it does not work correctly. The formatting of the data is the issue I think. That converts it in to completely wrong answers. (see image)
I have uploaded a BI file with just the data inserted. I did add a column in the excel sheet before I brought it in of the Excel *24 answers that we would need to achieve. I then added a column and did the calc as suggested. See the image the numbers are not correct. I assume it is related to the format of the time entry when I bring it from excel to Power BI, as it is showing as a long date format, but in excel it is an hours format. (blue arrow in image)
link to BI file
Link to excel data
Any suggestions greatly appreciated
- Anonymous7 years agoNot applicable
Hi Pmorg73
I see that the format for time taken as a long date and hence the formula gives different value.
Going through your file, assuming the time is shown in longdate format then I tweeked the formula
Time*24 = 'Table1'[[Time]] Time]*24 - 24By doing so I got the result the same as Time*24 done in excel and portedover.CheersCheenuSing