Forum Discussion

sureshsonti's avatar
sureshsonti
Icon for Helper II rankHelper II
8 years ago
Solved

Hours:Minutes

I have a table with Employee Code, Punch In and Punch Out values. The Data Type is Date/Time. I am trying to calculate hours:minutes for each employee and then sum all hours:minutes. I used this DAX statement 

 

TODAY_HOURS = DATEDIFF('tick'[drvt.punch_in_time_1], 'tick'[drvt.punch_out_time_1],HOUR)

 

It looks wrong. Please help

 

 

 

 

 

  • Hi sureshsonti,

     

    Seems these two columns don't have proper data type. Please check and change them into time.

    Hours_Minutes

     

    Best Regards,

    Dale

     

4 Replies

  • ChrisMendoza's avatar
    ChrisMendoza
    Icon for Resident Rockstar rankResident Rockstar

    I believe the DATEDIFF ( ) requires the datetime value not just the time value. Try it with a datetime field.

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi sureshsonti,

     

    Seems these two columns don't have proper data type. Please check and change them into time.

    Hours_Minutes

     

    Best Regards,

    Dale

     

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

      Dale,

      Your solution solved my issue. Thanks for your help.