Forum Discussion

khaycock's avatar
khaycock
Helper I
5 years ago
Solved

Summarising days/hours/mins

I have used the below to create a days/hours/mins field but it doesn't summarise because it's a text field. Is there any other calucation i can use which will allow me to summarise when there are mul...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi khaycock ,

     

    Will you consider to create a measure instead of a column?

    Measure = 
    var minu = SUM(tickets[ticket time])
    var hours = INT(minu/60)
    var days = INT(hours/24)
    var remainmin = MOD(minu,60)
    var remainhours = MOD(hours,24)
    return
    days&" days, "&remainhours&" hours & "&remainmin&" minutes"

     

    Best Regards,

    Jay

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi khaycock ,

     

    The only thing you need to do is to replace sum() to average().

    And if you want a whole number, you could add int() before mod().

    Refer:

     

    Measure 2 = 
    var minu = AVERAGE(tickets[ticket time])
    var hours = INT(minu/60)
    var days = INT(hours/24)
    var remainmin = INT(MOD(minu,60))
    var remainhours = MOD(hours,24)
    return
    days&" days, "&remainhours&" hours & "&remainmin&" minutes"

     

     

    Best Regards,

    Jay