Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Straight Table: sum(amount) when condition is fulfilled...

Hello,

I'm making a straight table with a sum of purchases shown for each month. This first column is for cloths, the next for household goods etc...

making the sum is not difficult: Sum(amount) but when I add an 'if' so I only include items that are cloths (for example Goods='cloths') the result is always zero.

Whats wrong with this statement as expression:

=if(Goods='Cloths',sum(Amount),0)

What should be changed?

1 Solution

Accepted Solutions
vijay_iitkgp
Partner - Specialist
Partner - Specialist

Hi,

Use Sum(If(Goods='Cloths',Amount))

View solution in original post

3 Replies
vijay_iitkgp
Partner - Specialist
Partner - Specialist

Hi,

Use Sum(If(Goods='Cloths',Amount))

Not applicable
Author

Thanks a lot!

Not applicable
Author

Just a small point - avoid using 'if' wherever possible as it has a perfomance overhead particularily with large amounts of data.

This should be more efficient:

sum(pick(match(Goods,'Cloths'), Amount))

Regrads,

Gordon