5 Replies Latest reply: Nov 11, 2014 8:45 PM by jagan mohan rao appala

# IF Sum of [Field] equals X or Y Expression

Hello,

Not sure why this following expression doesn't work:

if(Sum([Social-Mo])>=\$(=4)<=\$(=5),2340000*Sum([Social-Mo]))

If the Social-Mo field equals or is between 4 and 5, then multiple the sum of the Social-Mo field by 2,340,000. Can you let me know where I went wrong with this?

Also, ideally I would want it to be EITHER 4 or 5 but not sure what expression to use since OR is not valid. Thanks!

• ###### Re: IF Sum of [Field] equals X or Y Expression

Hi,

Try like this

Sum({<[Social-Mo]={'>=4<=5'}>}[Social-Mo]) * 2340000

Regards,

Jagan.

• ###### Re: IF Sum of [Field] equals X or Y Expression

Hi Jagan,

Appreciate the help! It's very close. My mistake however, I mean to say "If the Sum of the Social-Mo field equals or is between 4 and 5, then multiple the sum of the Social-Mo field by 2,340,000"

• ###### Re: IF Sum of [Field] equals X or Y Expression

if(sum([Social-Mo])>=4 and sum([Social-Mo])<=5,

sum([Social-Mo])*2340000,

0

)

• ###### Re: IF Sum of [Field] equals X or Y Expression

Hi Jason,

Where you are using this expression?  Are you using this in chart?  If yes then use below expression

If(Sum([Social-Mo]) >=4 and Sum([Social-Mo]) <=5, Sum([Social-Mo])* 2340000)

If you are using this in text object then try using Aggr()

=Sum(Aggr(If(Sum([Social-Mo]) >=4 and Sum([Social-Mo]) <=5, Sum([Social-Mo])* 2340000), SomeDimension1, SomeDimension2,...........SomeDimensionN))

Hope this helps you.

Regards,

Jagan.

• ###### Re: IF Sum of [Field] equals X or Y Expression

Hi Jason,

Can I suggest you try this expression

Sum(If([Social-Mo]>=4 AND [Social-Mo] <= 5,2340000*[Social-Mo],0))

I will also say don't use SUM when multiplying Social-Mo just leave it blank

Hope this helps

Best Regards,

Gabriel