Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

erickd1190
New Contributor III

Multiple Averages Problem

Hi Experts!

I have 5 flags for 5 fields that rate timeliness of service.

IF(A - Today()>0,1,0) AS ATimeFlag,

IF(B - Today()>0,1,0) AS BTimeFlag

IF(C - Today()>0,1,0) AS CTimeFlag

IF(D - Today()>0,1,0) AS DTimeFlag

IF(E - Today()>0,1,0) AS ETimeFlag

When I create a table it looks like this:

Type%Expression
A77%AVG(ATimeFlag)
B94%AVG(BTimeFlag)
C71%AVG(CTimeFlag)
D90%AVG(DTimeFlag)
E85%AVG(ETimeFlag)

Now what i need to do is Average all the percentages from the table above which should give me a result of 83%.

I tried:

AVG(AGGR({$<ATimeFlag,BTimeFlag,CTimeFlag,DTimeFlag,ETimeFlag={1}>}COUNT(distinct Id),service))

But didn't work.

PS. I still haven't fully wrapped my head around AGGR().

Any thoughts appreciated!

5 Replies
devarasu07
Honored Contributor II

Re: Multiple Averages Problem

Hi,

Can you share your mock data. Thansks

erickd1190
New Contributor III

Re: Multiple Averages Problem

Here is some mock data.

devarasu07
Honored Contributor II

Re: Multiple Averages Problem

Hi,

Unable to open/read

Services - Copy.xlsx file

In feature no need to send full data. based on u r issue/requirement just send mock value with few rows should be enough. Thanks

erickd1190
New Contributor III

Re: Multiple Averages Problem

Hi,

The

Services - Copy.xlsx is the same as Demo Data.QVD.

You really need these three:

Demodata.qvd

Staff- Copy.xlsx

Ethnicity- Copy.xlsx

The dates used to create the flags are in the Ethnicity file.

vinieme12
Esteemed Contributor II

Re: Multiple Averages Problem

Use

Rangeavg (field, field, ....)

Or

Aggr(Rangeavg (field, field, ...),Type)