# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for
Did you mean:
Contributor III

## Set Expression Avg Distinct

Is it possible to calculate an average within a set expression? I would like to calculate the average number of active employees for the current selection.
I am calculating the active EE by =num(COUNT({<PeriodType={'Current'},isActiveEmp_flg={1}>}DISTINCT Employee_Number),'#,##0')
After updating my expression to include Avg, I do not return any results. Is this due to aggregate and non aggregate?

Labels (2)

• ### Set Analysis

1 Solution

Accepted Solutions

If i understand correctly, You can define as

num(Avg(Aggr(COUNT({<PeriodType={'Current'},isActiveEmp_flg={1}>}DISTINCT Employee_Number),AsOfPeriod)),'#,##0')

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
4 Replies
Partner

How are u calculating the AVG?

u can't use 2 agg functions at the same time ; to use the avg, ur expression should be as follow:

avg(aggr(count(measure),dimension))

MVP
What exactly are you hoping to see when using the Avg? Is it a single number across all the AsOfPeriod? and what is the exact expression you have tried?

If i understand correctly, You can define as

num(Avg(Aggr(COUNT({<PeriodType={'Current'},isActiveEmp_flg={1}>}DISTINCT Employee_Number),AsOfPeriod)),'#,##0')

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Contributor III
Author