Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
darrin_pilkingt
Contributor II

Avg values with Aggr are not giving me what I am after

I am trying to identify the average calls per day for however many agents I select.  The call number for the day is not aggregated which is what I need.  I am trying to use Aggr to find the average calls by day and agent.  When I use Aggr I am not getting the same value as when I pre-aggregate the values by agent and day and then find the average.

Wrong Vaue: (but at the detail level I need)

My aggr formula at the detail level:    Avg(Aggr(sum(CallCounter), %DateKey, %AgentKey))

Value returned is 13.7.

Correct Value

Pre-Aggregated values:  32 is the average # Calls.

AgentNameCallsQty%DateKey
Bob148/26/2014
Bob188/29/2014
Bob248/27/2014
Mary268/26/2014
Mary278/23/2014
Mary278/31/2014
Mary288/24/2014
Mary288/27/2014
Mary298/5/2014
Mary308/25/2014
Mary328/12/2014
Mary328/17/2014
Mary348/6/2014
Mary348/20/2014
Mary358/2/2014
Mary358/11/2014
Mary368/18/2014
Mary368/30/2014
Mary378/3/2014
Mary388/13/2014
Mary398/9/2014
Mary408/16/2014
Mary418/10/2014
Mary438/4/2014
Mary458/19/2014
Average32

Thank you.

4 Replies
jyothish8807
Honored Contributor II

Re: Avg values with Aggr are not giving me what I am after

Hi Darrin,

IS this is what you want?

Regards

KC

Best Regards,
KC
jyothish8807
Honored Contributor II

Re: Avg values with Aggr are not giving me what I am after


If you remove the dimension then you will get 32.

Regards

KC

Best Regards,
KC
darrin_pilkingt
Contributor II

Re: Avg values with Aggr are not giving me what I am after

Jyothish,

Thank you for the quick reply.  There was actually no formula in the file. 

I did figure it out.  I have multiple facts concatenated and it seems to be changing how the formula is aggregating.

I added the following set analysis and it resolved it.

=Avg(Aggr(sum({<FactType = {Calls}>} CallCounter), %DateKey, %AgentKey))

Thank you.

jyothish8807
Honored Contributor II

Re: Avg values with Aggr are not giving me what I am after

Hi Darren,

I simply add a expression:

Sum(CallQty)/Count(Dates)

Regards

KC

Best Regards,
KC
Community Browser