Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
erickd1190
Contributor III
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
Master II
Master II

Hi,

Can you share your mock data. Thansks

erickd1190
Contributor III
Contributor III
Author

Here is some mock data.

devarasu07
Master II
Master II

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
Contributor III
Contributor III
Author

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
Champion III
Champion III

Use

Rangeavg (field, field, ....)

Or

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

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.