Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
vijetas42
Specialist
Specialist

Avg() in Straight Table

Hi,

Can anybody explain how avg() works in qlikview ?

Thanks!

4 Replies
awhitfield
Partner - Champion
Partner - Champion

avg([{set_expression}] [ distinct ] [ total [<fld { , fld } >]] expression)

Returns the aggregated average of expression or field iterated over the chart dimension(s).

Expression must not contain aggregation functions, unless these inner aggregations contain the total qualifier. For more advanced nested aggregations, please use the Advanced Aggregation function in combination with calculated dimensions, see Add calculated dimension... .

If the word distinct occurs before the function arguments, duplicates resulting from the evaluation of the function arguments will be disregarded.

If the word total occurs before the function arguments the calculation will be made over all possible values given the current selections but disregarding the chart dimension variables.

The total qualifier may be followed by a list of one or more field names within angle brackets. These field names should be a subset of the chart dimension variables. In this case the calculation will be made disregarding all chart dimension variables except those listed, i.e. one value will be returned for each combination of field values in the listed dimension fields. Also fields which are not currently a dimension in a chart may be included in the list. This may be useful in the case of group dimensions, where the dimension fields are not fixed. Listing all of the variables in the group causes the function to work when the cycle or drill-down level changes.

Examples:

avg(Sales)

avg(X'Y/3)

avg(distinct Price)

avg(total Sales)

avg({1} total Sales)

Andy

buzzy996
Master II
Master II

it will work same as ..how it works in other tools.which ever u know.

sum of records sales by /number of records based on ur dimenions

vijetas42
Specialist
Specialist
Author

Hi,

Thanks for your reply but, Will it consider all records or no. of values present after making all the selection in list boxes or after filtering data.

buzzy996
Master II
Master II

Will it consider all records --if u are not selected..then it will show ur avg based on all records

or no. of values present after making all the selection in list boxes --yes,if u have some selection then only show avg for only those records(means total u have 20 records for 2014(10 records) and 2015(records,if ur selections as year=2015..then it will sho avg only for those 10 records))or

after filtering data---after filtering the avg will calculate as said above.