Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
inescastelhano
Partner - Creator II
Partner - Creator II

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?

country.PNG

Cheers,

Inês

5 Replies
sunny_talwar

How about this:

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

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

     field1, field2, country, field4))

inescastelhano
Partner - Creator II
Partner - Creator II
Author

Hey Sunny!

Thanks for your help!!

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

country.PNG

Thank you!

sunny_talwar

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

inescastelhano
Partner - Creator II
Partner - Creator II
Author

Unfortunately I can't .

sunny_talwar

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