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.
Not applicable

Wrong Result in Aggr-Function

Hey all,

I have a problem conerning the aggr function. I have a number of keys and over the keys I want to sum the audience.

The problem is that I don't get the exact value in QlikView.

This is the right number in Excel:

Excel.PNG.png

And this is the result in QlikView:

Qlikview.PNG.png

The formula I use for calculation is:

     =Sum(Aggr(Sum(Distinct "audience (in mio) 14+ [adults]"), Keys))

It seems that QlikView calculates more values than it should do. But when I do a "Count(Distinct keys)", I get the right number of keys. That's why I'm confused and I can't figure out the error.

I have attached the Excel file and the QlikView file. I hope someone can help me!

Kind regards

Daniel

Tags (4)
1 Solution

Accepted Solutions
MVP
MVP

Re: Wrong Result in Aggr-Function

QlikView is giving Correct Result as there are duplicate Keys in your excel file which is not giving correct results...

Sport1417680,573229166666667
RTL417970,738888888888889
ZDF417970,979166666666667
RTL417970,7875
RTL417980,794444444444444
RTL417980,78125
RTL417980,829861111111111

For the First Record, There are two Values Exists...0.13 and 0.05, But your Excel is only Considering 0.13... The same happenning with above all shown Keys...

Hope this will clear your doubt...

2 Replies
MVP
MVP

Re: Wrong Result in Aggr-Function

QlikView is giving Correct Result as there are duplicate Keys in your excel file which is not giving correct results...

Sport1417680,573229166666667
RTL417970,738888888888889
ZDF417970,979166666666667
RTL417970,7875
RTL417980,794444444444444
RTL417980,78125
RTL417980,829861111111111

For the First Record, There are two Values Exists...0.13 and 0.05, But your Excel is only Considering 0.13... The same happenning with above all shown Keys...

Hope this will clear your doubt...

Not applicable

Re: Wrong Result in Aggr-Function

Thank you, Manish! I would have never figured that out!

I'm relieved that the problem lied in the excel data and not within QlikView, Phew!

Have a nice day!

Community Browser