Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
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.

2 Replies
sunny_talwar

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

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)