Forum Discussion

2 Replies

  • Hi Dicken​,

    Could you please share a small example of the data and the result you are trying to produce?

    For example, it would help to know whether you have:

    StartDateTime
    
    EndDateTime

    and want the elapsed time between them expressed as total hours, such as 2.5 hours.

    Also, are you looking to calculate this in DAX, Power Query, or as a calculated column/measure?

    If you can post 3-4 sample rows together with the expected Total Hours result, it should be possible to give you the correct expression without making assumptions.

    AI-assisted drafting: AI was used to help structure and phrase this response. I reviewed and validated the technical content before posting.

  • Hello Dicken​ 

    To calculate total hours between two date/time columns, go to Add Column → Custom Column,

    Total Hours =

    Duration.TotalHours([EndDateTime] - [StartDateTime])

    Replace the column names with yours. Both columns should have the Date/Time type; set the result to Decimal Number.

    Example: 28 September at 08:00 → 29 September at 10:30 returns 26.5 hours.

    If you have only one date/time column, share an example value and your expected result.

     

    If my response helped you, please consider clicking
    Accept as Solution and giving it a Like – it helps others in the community too.

    Thanks,

    Connect with me on:
    LinkedIn |
    Data With Pankaj - YouTube