Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

sum values within column group by store

Hi, how can I sum the values group by store? My current table is as such:

StoreValue
A2
A6
A8
B1
B7
B3
C9
C2
C8

How can I create this table? :

StoreValue
A16
B11
C19

Thanks.

1 Solution

Accepted Solutions
MVP
MVP

Re: sum values within column group by store

Hi,

If you want to do this in script then try like this

Data:

LOAD Store,

     Sum(Value) AS Value

FROM DataSource

GROUP BY Store;


If you want to achieve this in chart


Dimension: Store

Expression: Sum(Value)


Hope this helps you.


Regards,

Jagan.

6 Replies
Not applicable

Re: sum values within column group by store

Hi ,

Try Like this :

Load Store ,sum(Value) from [table name] group by Store;

Thanks !!

ecolomer
Honored Contributor II

Re: sum values within column group by store

See this

MVP
MVP

Re: sum values within column group by store

Hi,

If you want to do this in script then try like this

Data:

LOAD Store,

     Sum(Value) AS Value

FROM DataSource

GROUP BY Store;


If you want to achieve this in chart


Dimension: Store

Expression: Sum(Value)


Hope this helps you.


Regards,

Jagan.

Not applicable

Re: sum values within column group by store

Thanks. May I ask why is this an invalid expression? :

load *,

sum(Value) as [Value (S$)]

Resident FinalTable group by Store;

Not applicable

Re: sum values within column group by store

bcz u have mention * .

* means All  and u r using value as twice .

Thanks !!

MVP
MVP

Re: sum values within column group by store

Hi

If you use a group by clause, you must explicitly list all the fields not in aggregate functions. Since you have specified * (which is implictly all fields in the table), you will need to include all of these fields in the group by clause.

Otherwise, use

load Store,

sum(Value) as [Value (S$)]

Resident FinalTable group by Store;

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Community Browser