Forum Discussion

MarcusR1's avatar
MarcusR1
Icon for Helper II rankHelper II
2 years ago
Solved

Time calculation and formating in Power BI

Hi, I have some time related data including start, stop and duration (in seconds) and I want to display a summary card with the hours:minutes:seconds but I can't seem to get the formula to work:

 

Data:

date start end duration
01/01/2024 00:00 01/01/2024 08:54 01/01/2024 09:25 1835
01/01/2024 00:00 01/01/2024 10:01 01/01/2024 10:26 1468
01/01/2024 00:00 01/01/2024 11:04 01/01/2024 11:46 2517
01/01/2024 00:00 01/01/2024 12:21 01/01/2024 13:20 3581
01/01/2024 00:00 01/01/2024 13:42 01/01/2024 14:43 3627

 

Formula:

hoursFormatted = Format(data[duration],"hh:nn:ss","en-GB")

 

Result:

 

can anyone help?

thanks

 

4 Replies

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

    MarcusR1 Should just be:

     

    Duration = [end] - [start]
    
    DurationFormatted = FORMAT([duration], "hh:mm:ss")

     

    • MarcusR1's avatar
      MarcusR1
      Icon for Helper II rankHelper II

      Thank you Greg, that's great. How do I sum those to get:

       

  • Screenshot of what Greg Deckler has just suggested you 🙂

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi MarcusR1 ,

    Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

    If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

    How to Get Your Question Answered Quickly 

    Regards,

    Xiaoxin Sheng