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: 
george55
Partner - Creator III
Partner - Creator III

Aggr() - when use?

Hi all,

Did not get yet when to use the Aggr() function and when not. 

Sometimes facing up in situations where everything is working correct except when I want to show data, like below in a table, with aggegate value on the top (Gesamtwerte). Without using Aggr() the aggreagate values are sometimes wrong. E.g. in my example Column 5 ("Eingegang Anruf"). Total 6587 is wrong, correct is 6828.

So I use then Sum(Aggr(...) and it is fine. But on the other hand, when I use the objects alone, not in a table, I get wrong results. So that means I have to put every dimensions in the Aggr() function. But this has an other bad impact. performance of the app! Many times the App and the hole Qlik Engine are struggling and crashing (see one error below).

Can anybody help?

Thanks

George

 

2020.0224-173200.jpg

 

2020.0224-172851.jpg

Labels (1)
  • SaaS

5 Replies
Vegar
MVP
MVP

Are you sure that 6587 is wrong?  Could it be that a transaction row could be connected to more than one "Gemensamwerte" dimension value? If so then the sum of rows will not neccesary be equal to the expresion total.

 

Consider my attached example where I have transaction per country, but some of the countries are associated to more than one geographical region. In this case the rows are correct, but the aggr() total is not even if it is equal to the sum of rows.

 

image.pngimage.png

george55
Partner - Creator III
Partner - Creator III
Author

Hi Vegar,

Do understand your comments. In my case I have only one table, not linked with others. That's the reason why I do not understand it.

However I understood to use both variants, one with and one without Aggr(). But the problem I do have is that Aggr() is using too much ressources, so Qlik crashes. Do you have an Idea who to avoid it? Maybe I can load Aggr()-"Tables" in the load script to have precomputed values? If possible, how do I have to implement it?

Vegar
MVP
MVP

What about NULL values? Are you limiting you table to exclude NULLs?

image.png

 

Spoiler
set NullInterpret ='';
LOAD * inline [
Country, Amount
Norway, 10
Sweden, 10
Denmark, 10
Finland, 10
Iceland, 10
, 10
];

 

 

george55
Partner - Creator III
Partner - Creator III
Author

just checked. Limiting with and without NULLs brings the same result.

george55
Partner - Creator III
Partner - Creator III
Author

It is a Distinct problem. So I have to use the Aggr() function.

 

Count(Distinct {<Calldirection={'Inbound'}, [EventType]={'TALKING'}>} CallId)
/
Count(Distinct {<Calldirection={'Inbound'}>} CallId)

 

Is there a way to avoid using Aggr() ? Maybe I can do something in the load-script?