Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
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
jagan
Partner - Champion III
Partner - Champion III

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.

View solution in original post

6 Replies
Not applicable
Author

Hi ,

Try Like this :

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

Thanks !!

ecolomer
Master II
Master II

See this

jagan
Partner - Champion III
Partner - Champion III

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
Author

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

load *,

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

Resident FinalTable group by Store;

Not applicable
Author

bcz u have mention * .

* means All  and u r using value as twice .

Thanks !!

jonathandienst
Partner - Champion III
Partner - Champion III

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