Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Not applicable

Nested Aggregation Not allowed?

HI,

This is the formula I want to use in a pivot table.

count(    if(

(Status_Incidents='Closed' or Status_Incidents='Resolved'

or (Status_Incidents='Waiting' and [Assignment Status]<>'Completed')),Status_Incidents,

if((if((count(if([Assignment Status]<>'Forwarded', [Incident #])))=0,'Forwarded',

if((count(if(([Assignment Status]='Waiting' or [Assignment Status]='Accepted'), [Incident #])))=0,'Completed',

if((count(if([Assignment Status]='Accepted', [Incident #])))>0,'Accepted','Waiting')

)

))='Completed', InCompleted',Status_Incidents)

))

It is showing the error "Nested Aggregation Not allowed".

I dont think if I can use Aggr because of the conditions used.

Can anyone help me on this?

Tags (2)
11 Replies
Highlighted

Re: Nested Aggregation Not allowed?

I think you are doing Count(if(Count(.... which is not possible without an Aggr() function... Why do you think that you cannot use Aggr() here? Can you may be share a sample for us to help you better?

Highlighted
oknotsen
Honored Contributor III

Re: Nested Aggregation Not allowed?

I can not judge about your actual question, but looking at your nested IF circus, I would suggest to try and move a bunch of these things to your script and add them there as Flag fields. Bit better for performance to. That would deduce the size of your expression here which in turn might make it easier to find the problem.

May you live in interesting times!
Highlighted
Not applicable

Re: Nested Aggregation Not allowed?

I think aggr works like Group By. How do I use aggr function for lets say the following?

(count(if([Assignment Status]<>'Forwarded', [Incident #])))=0

Highlighted
Not applicable

Re: Nested Aggregation Not allowed?

Lets say even If I put the following in Script also:

(if([Assignment Status]<>'Forwarded', [Incident #]))

Again, we will have to use count within a count.

That is what is actually causing the issue.

Highlighted

Re: Nested Aggregation Not allowed?

This particular expression only includes 1 aggregation function -> Count....

Can you maybe share some more information as to what you are hoping/trying to do?

Highlighted
Not applicable

Re: Nested Aggregation Not allowed?

Yes One aggregation function is used. But Its like one inside another.

I am trying to get the count of Incidents according to some of the conditions which also include count.

Highlighted

Re: Nested Aggregation Not allowed?

Chetna -

I am afraid, I still don't understand your context here. Either share more information (may be like a sample or sample of data or images) or I would hope that someone else might be able to offer you better help.

Best,

Sunny

Highlighted
Not applicable

Re: Nested Aggregation Not allowed?

HI,

I want this report in QlikSense. where the formula for count is what I have mentioned above.

Highlighted
vinieme12
Esteemed Contributor II

Re: Nested Aggregation Not allowed?

Can you explain the calculation criteria's may be we can simplify

Not sure what you are trying to do here

count(    if(

(Status_Incidents='Closed' or Status_Incidents='Resolved'

or (Status_Incidents='Waiting' and [Assignment Status]<>'Completed')),Status_Incidents,

if((if((count(if([Assignment Status]<>'Forwarded', [Incident #])))=0,'Forwarded',

if((count(if(([Assignment Status]='Waiting' or [Assignment Status]='Accepted'), [Incident #])))=0,'Completed',

if((count(if([Assignment Status]='Accepted', [Incident #])))>0,'Accepted','Waiting')   ' Here you classify Accepted or Waiting but in the outer                                                                                                                                             if  you are considering both , why classify then?

)

))='Completed', InCompleted',Status_Incidents)

))

Can you post sample data /app and expected output