Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Converting time value to a decimal number so it could be displayed as a value

Hey everyone,
So initally i had two time values, which was StartTime and EndTime and right now I got the duration between both as one column, but in the duration format. The problem is, I can't figure out how to make it as a decimal or whole number, so I could display it as a sum in histogram. The closest I got to this is take duration as total hours, however, I need precise time to be displayed in the histogram as a value. Any ideas? 

9 Replies

  • Jimmy801's avatar
    Jimmy801
    Icon for Community Champion rankCommunity Champion

    Hello Anonymous 

     

    check out this code

     

    let
        StartTime = #time(12,0,0),
        EndTime = #time(16,30,0),
        DurationDigital = Number.From(EndTime-StartTime)*24
    in
        DurationDigital

     

    Copy paste this code to the advanced editor in a new blank query to see how the solution works.

    If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
    Kudoes are nice too

    Have fun

    Jimmy

    • Anonymous's avatar
      Anonymous
      Not applicable

      It seems like its displaying 4,5, but i would need it to be 4:30(as a decimal number) if that makes sense.
      Thanks for your help.