Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

srikanthsri1
Valued Contributor

Why my Aggregation values are so high for simple expression like sum(sales)

Hi all,

        This might be dumb question .......but i'm struggling to find a answer

In my script i'm doing a group by (for a range of dates using a for loop for every week) with respect to my primary key and i see all aggregated values for a given key

but when i select a single key(primary key values my and gave expression like sum(sales ) ina text box..the values are very high ..

can somebody throw some light on how group by and aggregation work in qlikview.

and here i'm attaching my application and data file to get an overview of what i'm doing ...

i'm not sure whether it's right way to use a for loop and follwed by groupby ..plz throw some light on this

and guide me with your valuable suggestion

H

1 Solution

Accepted Solutions

Re: Why my Aggregation values are so high for simple expression like sum(sales)

You have a very large number of duplicate records in your tables. Add a straight table with all the fields of table Main and as expression count(%Key). You probably need to take another good look at how you create your tables.


talk is cheap, supply exceeds demand
4 Replies
srikanthsri1
Valued Contributor

Re: Why my Aggregation values are so high for simple expression like sum(sales)

i just got a partial answer

for table Main2

where i did groupby with respect to 1 dimension

the values are matching by changing the expression as

avg(sumgallon)..

but this is not working for another table i.e Main table where

i used groupby with respect to three dimension

how to get an average for three dimension (grouped value)

please help

Re: Why my Aggregation values are so high for simple expression like sum(sales)

You have a very large number of duplicate records in your tables. Add a straight table with all the fields of table Main and as expression count(%Key). You probably need to take another good look at how you create your tables.


talk is cheap, supply exceeds demand
srikanthsri1
Valued Contributor

Re: Why my Aggregation values are so high for simple expression like sum(sales)

thanks fro reply and your are exactly correct..i'm having so many duplicate values ..........

initallly i'm not aware of this .... can we please suggest .....how to remove this duplicate values ...

i'm not that good at scripting qlikview

srikanthsri1
Valued Contributor

Re: Why my Aggregation values are so high for simple expression like sum(sales)

Thanks Gysbert, for your response ..i have been struggling to get a correct answer fro 2 week .......

with your reponse i came to know the right spot to look at .......great help ..reallly appricate it

now it's working fine ..

i stored the table into a qvd and again used distinct for key field ....

now all my values are uniques and working fine for expression sum

Community Browser