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: 
bwillis0802
Contributor
Contributor

IF(SUM...) not adding

Hello,

I am attempting to write an IF statement that sums all types of receipts except those with a Capitation payment methodology.

I have written: IF([CONTRACT.VBA_METHOD] = 'Capitation', 0, SUM([RCPT.RCPT_AMT]))

It works when in my filters I specifically select everything except Capitation; but when no filters are applied my original sum still appears. How do I fix this so I don't have to have both the statement and have end-users manually filter it out?

3 Replies
chrismarlow
Specialist II
Specialist II

Hi,

I would either put the If inside the sum, or use set analysis, so;

SUM(IF([CONTRACT.VBA_METHOD] = 'Capitation', 0, [RCPT.RCPT_AMT]))

or

SUM({<[CONTRACT.VBA_METHOD] -= {'Capitation'}>}[RCPT.RCPT_AMT])

Cheers,

Chris.

bwillis0802
Contributor
Contributor
Author

Hi Chris,

Thank you for your help. The second statement pulls in Capitation only, is
there a way for it to do the opposite?
chrismarlow
Specialist II
Specialist II

Hi,

Not sure how that is happening ... not what I see in toy app below ... am I missing something?

20220204_1.png

Cheers,

Chris.