exceldaxdatamodel

DAX Excel Power Pivot: Time Difference in Decimal


I am using Power Pivot for Data Analysis. I have two Date/Time fields and I wanted to calculate Time Difference between them in Decimal Hours.

e.g.

Date/Time 1 = 30-06-2022 23:58:56 Date/Time 2 = 01-07-2022 02:30:00

So the time difference between them is 2 hours 32 minutes. So in decimal it should show 2.5x hours.

I need this data in Calculated Column. How to achieve this in Data Model of Power Pivot?

Thanks in advance!


Solution

  • Simply

    ( [Date/Time 2] - [Date/Time 1] ) * 24