Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IF Expression Error

Hi,

we are trying a simple IF expression, we are not getting an error with the syntax but the results will not load.

It is simply:

if(Sum(Cases*-1>80),'80-100',if(Sum(Cases*-1>60),'60-80', 0))

We have tried numberous different expressions but cant seem to get it.

We are trying to group the values of the cases into sub groups of ranges.

The Cases value on the file is negative, thats why we are mulitplying by -1.

Thanks,

Gregg

1 Solution

Accepted Solutions
MayilVahanan

HI

Try like this

Dublin:

Load * from HeatMap.xls;

inner join(Dublin)

Load Product,

f(Sum(Cases)*-1>80,'80-100',

    

        if(Sum(Cases)*-1>60,'60-80', 0)) as FieldName

resident Dublin group by Product;

whenever you use aggregation function like sum(),you must use group by clause .

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

10 Replies
Not applicable
Author

Hi

if(Sum(Cases)*-1>80,'80-100',

     

        if(Sum(Cases)*-1>60,'60-80', 0))

use this expression

Not applicable
Author

Hi,

I have tried this expression before and I just tried it again to be sure but still no joy.

Thanks,

Gregg

rajeshvaswani77
Specialist III
Specialist III

Hi Gregg,

It works for me, the expression is right. Can you post an example?

thanks,

Rajesh Vaswani

Not applicable
Author

Hello

i tried below expr it work to me

if(sum(sal)*-2*-1>=10000,sal,

      if(sum(sal)*-3*-1>=20000,sal,0))

same as above expr it works check the syntax

its_anandrjs

Hi,

Use this script

if(Sum(Cases)*-1<80,'80-100',

             if(Sum(Cases)*-1<60,'60-80', 0))

Because your values going negative.

Regards,

Anand

Not applicable
Author

ERROR.png

Hi,

I tried it in the script also and got the attached error when loading.

I was trying it as an expression in a list box previously.

Regards,

Gregg

Not applicable
Author

ERROR.png

Hi,

I tried it in the script also and got the attached error when loading.

I was trying it as an expression in a list box previously.

Regards,

Gregg

MayilVahanan

HI

Try like this

Dublin:

Load * from HeatMap.xls;

inner join(Dublin)

Load Product,

f(Sum(Cases)*-1>80,'80-100',

    

        if(Sum(Cases)*-1>60,'60-80', 0)) as FieldName

resident Dublin group by Product;

whenever you use aggregation function like sum(),you must use group by clause .

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi,

Thanks that worked.

Do you load product again to beacuse the cases are of certain products?

And the group by statement is used because we need them grouped into different categories, e.g. (80 - 100)

I just want to understand so I know for future expressions.

Thanks,

Gregg