5 Replies Latest reply: Aug 31, 2016 11:48 AM by Sunny Talwar

# Sum if not working

Dear all,

I have the following expression:

SUM(IF(Aggr(\$(variable1),field1, field2, country, field4)>=1 and

Aggr(\$(variable1),field1, field2, country, field4)<6,1,0))

and it is working fine, as one can see in the table below. However, if instead of 1,0 I use an expression, my expression doesn't work anymore.

SUM(IF(Aggr(\$(variable1),field1, field2, country, field4)>=1 and

Aggr(\$(variable1),field1, field2, country, field4)<6,Count (Distinct{(<field5 = {'Submitted'},

field6={'Owner'}, field7 -= {'Event'}>)*<field8={\$(variable2)}>}field1),0))

Moreover, if I use the count distinct separately, it works.

Could anybody help me with this?

Cheers,

Inês

• ###### Re: Sum if not working

Sum(Aggr(If(\$(variable1) >= 1 and \$(variable1) < 6,

Count(Distinct{<field5 = {'Submitted'}, field6={'Owner'}, field7 -= {'Event'}>*<field8={\$(variable2)}>} field1), 0),

field1, field2, country, field4))

• ###### Re: Sum if not working

Hey Sunny!

However, this returns the same result than the 1,0 expression... I don't really understand why, but... should not be, I guess...

Thank you!

• ###### Re: Sum if not working

It would be hard to say without taking a look at your data here. Would you be able to share your qvf file?

• ###### Re: Sum if not working

Unfortunately I can't .

• ###### Re: Sum if not working

May be mock up some data and provide a sample with the expected output from that data?