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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using if vs. coding it in the set analysis

I have a query the first one works but the second one does not.

Works-

if(BOB = 'A',
(sum({$<BOB_age={'$(=DATE(vC))'},age={'>=16 <=25'} >} aging_A) *100),
(sum({$<BOB_age={'$(=DATE(vC))'},age={'>=16 <=25'} >} aging_B) *100))

Does not work:

sum({$<BOB-={'A'},BOB_age={'$(=DATE(vC))'},age={'>=16 <=25'} >} aging_A) *100
+sum({$<BOB={'A'},BOB_age={'$(=DATE(vC))'},age={'>=16 <=25'} >} aging_B) *100

Why?

Thanks.

Labels (1)
2 Replies
sunny_talwar
MVP
MVP

Did you do it opposite?

Sum({$<BOB ={'A'},BOB_age={'$(=DATE(vC))'},age={'>=16 <=25'} >} aging_A) *100

+Sum({$<BOB -={'A'},BOB_age={'$(=DATE(vC))'},age={'>=16 <=25'} >} aging_B) *100

sunny_talwar
MVP
MVP

Further I would try to use RangeSum() function here to sum them:

RangeSum(Sum({$<BOB = {'A'}, BOB_age = {'$(=DATE(vC))'}, age = {'>=16 <=25'} >} aging_A) * 100, Sum({$<BOB -={'A'}, BOB_age = {'$(=DATE(vC))'}, age = {'>=16 <=25'}>} aging_B) * 100)