Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issues using the "Avg" function

Hi All,

Has anybody experienced any issues using the avg function within Qlikview?

I have created a straight table containing 14 lines of data (by date) for a number of fields 'units' 'visits' & 'conversions' (units/visits)

I have some text boxes that will display summarised values, the text boxes containing sum("fieldname") are fine but those with avg("fieldname") are not producing the correct values.

Sure I am missing something straightforward or simple somewhere but I cannot seem to fathom it out - can anybody help??

Thanks

(Unfortunately due to business constraints I cannot post the app - but a screenshot demonstrating the prob is below)

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Yes, and? What's the result you're expecting? Do you want an average of the sums instead of an average of the actual values themselves? In that case try avg(aggr(sum(units),date))


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Null values are disregarded by the avg function. So if a record doesn't have a value that record will not be included to calculate the average. That is correct imo, but it may not be what you want. In that case you can divide the sum by the count, i.e. sum(units)/count(units). Or you can try to replace the nulls in the script with real values.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks Gysbert thats useful to know

However not sure that is the problem in this case: if you look at the screenshot (now attached) you should be able to see that for the current selection there is no null values! That's what is baffling me

Capture.PNG

Gysbert_Wassenaar

Yes, and? What's the result you're expecting? Do you want an average of the sums instead of an average of the actual values themselves? In that case try avg(aggr(sum(units),date))


talk is cheap, supply exceeds demand