Forum Discussion

shastie's avatar
shastie
Regular Visitor
5 years ago

Sum Times

Hi all,

I successfully used a calculated column using DAX  to sum times that were formatted in excel to a custom format [h]:mm:ss.

 

The formula that was used :

Formatted = 
VAR _DaysInHours = INT('Table'[DateTime]) * 24
VAR _Hours = INT(MOD('Table'[DateTime],1) * 24)
VAR _Minutes = FORMAT(MOD('Table'[DateTime],1),"nn:ss")
RETURN
    _DaysInHours + _Hours & ":" & _Minutes

 

However now i do not have the option to sum these in my visualisation, only count.

 

Can anyone help?

2 Replies

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    Your variable that uses FORMAT and your return are text type so can't be summed.  I would use a similar approach to sum everything in minutes and then divide by 60 to get total hours in decimal form.

     

    Regards,

    Pat

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi shastie ,

     

     

    I think you may not select Don't summarize.

     

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.