Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

How to convert DATE/TIME Column to duration?

Hello Everyone,  I linked an external database to access and then linked from access to PowerBI. I am trying to create a dashboard to extract worked hours, but when doing the link described above...
  • d_gosbell's avatar
    3 years ago

    You cannot automatically convert a Time column to a duration since a Time is a single point in time so it has no duration. But in your case it sounds like something like 05:00 should be a duration of 5 hours. So one way to do this is calculate the duration from midnight to the specified time. You can do this by subtracting a time of "00:00" from your current time column (subtracting one time from another returns a duration)

     

    If you click on "Add Column" in the ribbon then choose the "Custom Column" optoin and enter a formula like the following it will return a duration.

     

    [YourTimeColumn] - Time.FromText("00:00:00")