Page 1 of 1

AVG - time (based on group band condition)

Posted: Fri Dec 25, 2020 11:07 pm
by brjohnsmith
Hi,

I used the DateDiff to get the difference between two time, however, I need to get the average of this time based on the count that I have on group band. for numeric value, if I just divide the numbers by count(), I get the average, but I cannot do it with the time format. please it seems that I need to convert it before to numberic, divide to the Count function (average), and only then to convert to time again. I am not sure if it is this way, but if someone knows how to solve it, I would appreciate it a lot. thx.

Re: AVG - time (based on group band condition)

Posted: Mon Dec 28, 2020 1:51 pm
by Lech Kulikowski
Hello,

Please check the following expression:
{TimeSpan.FromMinutes( AvgD( DateDiff(Date1,Date2).TotalMinutes) )}

Thank you.

Re: AVG - time (based on group band condition)

Posted: Mon Dec 28, 2020 4:45 pm
by brjohnsmith
Hi Lech, it worked, thx a lot.

Re: AVG - time (based on group band condition)

Posted: Tue Dec 29, 2020 5:12 am
by Andrew
You are welcome!