# Aggregations of time-durations with groupBy

Hello,

I have a table with a Duration-column and would like to calculate the mean of those Durations with the groupBy-node. This seems not possible. Is there an obvious solution?

I could use the “Duration to Number”-node and then calculate the mean, but unfortunately there seems to be no “number to Duration”-node.

Best regards

hi there
you might need to use the binner node first to create “duration segments” and then you do the group by on these where you can also get the mean duration of the duration segments

your answer is not completely clear to me. Do you describe how to produce an estimate or how to produce a precise mean?

My Interpretation in the first case is the following: I define several bins and manually compute the middle values of those bins. Then I count how many entries are in which bin and assume that all entries are precisely the middle value of the bin. Then I multiply the number of entries in each bin with this middle value, sum all results up and divide by the number of all entries.

In fact, I’m not quite sure how this could solve my problem, since it does not seem to remove the Problem that there is no build-in way of doing arithmetics with durations. Or did I understand you wrong?

Best regards

hi there
it would be best, if you can provide a simple demoworkflow or at least dataset in order to create a sollution for you. please have a look at the group by node too, that offers most of the calculations that you mention.

Hello,

it’s okay, I already solved the problem, I just wanted to know if it is possible to solve it elegantly.

Best regards