Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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!

5 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

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


Regards,

Jagan.

Not applicable
Author

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"

maxgro
MVP
MVP

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

  sum([Social-Mo])*2340000,

  0   

  )

Gabriel
Partner - Specialist III
Partner - Specialist III

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

jagan
Luminary Alumni
Luminary Alumni

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.