Reputation: 643
When adding a custom column in Power BI, is there a way of making that column calculated from a text D:HH:MM:SS column, to a decimal "Days" column?
The raw data I have in the CSV, is in text format (first column), should end up having a calculated column of Days:
If there's not a calculation, is it possible to parse the text of the first column into D, H, M, S and then calculate Days from the resulting text?
Thanks for any help,
Mark
Upvotes: 0
Views: 1038
Reputation: 13440
One way to do this is to split the column by delimiter (colon in this case)
to get separate columns for days, hours, minutes and seconds:
And then add a custom column using this formula:
[Text.1] + ([Text.2]/24) + ([Text.3]/1440) + ([Text.4]/86400)
to calculate the decimal duration:
Of course, you can delete these columns later if you don't need them, or you can rename them to something more meaningful if you decide to keep them.
Upvotes: 1