Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Average of sum

I am looking for one way to get an average of sum. I tried avg(sum(fieldname)) and in return I got only 0.

In my example I got car inspeccions done and I want to know in average how much I do by hour for instance.

My data is loaded inspeccion by inspeccion and has got all the information concerning the exact time it is done.

thanks in advance for the help,


4 Replies

You could use the aggr function. Let's say you want to calc the avg of some sum per hour that would be


The aggr function gives you a list of values calculated by HourFieldname, which you then calculates the avg of.


This is a nested aggregation. You first want to sum the costs per inspection. Then you want to calculate some average. For instance the average cost per inspection would be

     Sum(Cost)/Count(distinct Inspection)


     Avg(Aggr(Sum(Cost), Inspection))

How you want the number of hours to influence the calculation I am not sure. Perhaps


and use Inspection as dimension?


Not applicable

Aggr(Sum(Cost), Inspection) / Count(distinct Inspection)

Not applicable

thanks for your tip.

I tried using aggr function but it didn't work as I was expecting. I end up dividing sum (receptions) by count (distinct calendardate) and it work perfectly.