8 Replies Latest reply: Jul 19, 2017 5:17 AM by Tim Driller

# using and operator in if condition

How do we use and operator in if condition.

for eg.

if we need to represent account between 1 million and 5 million, so do we do that?

• ###### Re: using and operator in if condition

in Expression

=if(account >1000000 and account <5000000, THEN , ELSE)

in Script

if(account >1000000 and account <5000000, THEN , ELSE) as Field,

Regards

tim

• ###### Re: using and operator in if condition

I need to use and in above condition for middle account along with aggregate and sum function.

• ###### Re: using and operator in if condition

seems like you should use it like this:

aggr(sum(if(middle_account>1000000 and middle_account<5000000, middle_account)), YourDimension)

• ###### Re: using and operator in if condition

=if(Aggr(sum(Revenue),[Customer Group Descr])<1,'Tail Account',

if(Aggr(sum(Revenue),[Customer Group Descr])>1 and Aggr(sum(Revenue),[Customer Group Descr])<5,'Middle Account',

if(Aggr(sum(Revenue),[Customer Group Descr])>=5,'Large Account'))

I m getting error in this expression

what is wrong with it?

• ###### Re: using and operator in if condition

do you really Need the aggr() function at this Point?

if you have Customer Group Descr as Dimension you can use this expression:

if(sum(Revenue) < 1,'Tail Account',

if(sum(Revenue)>1 and sum(Revenue) <5,'Middle Account',

if(sum(Revenue)>=5,'Large Account')))

• ###### Re: using and operator in if condition

Yes, as I need to group by customer group descry.

• ###### Re: using and operator in if condition

This AND is not working fine.

I m getting invalid dimension error.

• ###### Re: using and operator in if condition

can you share a sample qvw?