Forum Discussion

yjk3140's avatar
yjk3140
Icon for Helper I rankHelper I
4 years ago
Solved

calculate time difference between two timstamp columns in direct query mode in PowerBI

I need to calculate the time difference between two timestamp columns in my table and create a new column with the calculated values but as I'm doing this in the direct query mode, I have some limita...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi yjk3140 ,

    Please try below steps.

    1.in power query pane, change the data type to "Date/Time/Timezone"

     

    2. add a new column with below dax formula

    Hourly Diff =
    DATEDIFF ( 'Table'[Time stamp2], 'Table'[Time stamp 1], SECOND ) / 3600
    

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_ Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.