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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional sum (for different group)

Hi everyone,

I would like to do a sum(aggr())in script if possible since my pc is really slow in doing further calculation based on that.

Case like. I have a list of ID, all with there teams. example:

ID, team, fee

1,A,3

2,B,5

3,A,8

etc.

There are about 200000 unique ID and 4 teams. How can I add up all fees belonging to the same team in script, but not using aggr/partial sum in pivot table.

Many thanks,

Ivan

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

SumFees:
LOAD
team,
sum(fee) as "Total Fee"
RESIDENT data
GROUP BY team
;

-Rob

View solution in original post

3 Replies
Anonymous
Not applicable
Author

Proabably what you can do is write SQL and make a new field to get the sum using group by statement (cretea a new temp table and use join to attach to the original table). use avg(newfle) in the pivot table- carefull it should pivot on the same group else you will have differnt answer.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

SumFees:
LOAD
team,
sum(fee) as "Total Fee"
RESIDENT data
GROUP BY team
;

-Rob

Not applicable
Author

Hi Rob,

Thanks to your suggestion. It's work. However, I have something similar here that fields are not from one table, fields are from several tables which linked in Qlikview. I try to use 'from field' to do it. But there is something wrong....

Regards,

Ivan