Forum Discussion

sharpedogs's avatar
sharpedogs
Advocate II
6 years ago
Solved

Time Duration - Help I'm lost...

Hi,  The dataset I have reflects the below date/time format, along with the duration. When I input the data into PowerBi all three time columns end up with an AM or PM at the end and the duration do...
  • vivran22's avatar
    6 years ago

    Hello sharpedogs,

     

    In my experience, dealing with time values is quite tricky in Power BI/Query. I follow simple steps in Power Query to convert such values to ease out the calculation (converting it into number format)

     

    For your sample data, I may recommend the following:

     

    Convert the data type of the Duration field as Time:

     

     

    Then convert it into Decimal Number:

     

     

    Transform > Standard > Multiply by 24:

     

    This will convert the time value of 10:11:53 as 10.19 hours

     

     

     

    Another alternate route is to calculate it from Start & End session columns:

     

     

    Add a custom column:

     

     

    Change the type as Duration

     

     

    Transform > Duration > Total Hours

     

     

    Hope this will solve the purpose.

     

    Cheers!
    Vivek

    If it helps, please mark it as a solution
    Kudos would be a cherry on the top 🙂

    https://www.vivran.in/

    Connect on LinkedIn