1 Reply Latest reply: Jun 14, 2017 5:47 AM by Jonathan Dienst

# If statement - transform from Expression to Script

I got these 2 expressions. IS it possible to "move" them to script? Need to use these as Dimensions other than Expressions in my tables. Thank you.

1. 1. Status New:

if(
(
sum({<[Rolling Account Year Three]={'Most Recent'},[New/Renewal]={'New'}>} [Written Premium])/1000 >0 and
sum({<[Rolling Account Year Three]={'First Prior'},[New/Renewal]={'New'}>} [Written Premium])/1000=0),'New')

1. 2. Status:

if(
(
sum({<[Rolling Account Year Three]={'Most Recent'}>} [Written Premium])/1000 - sum({<[Rolling Account Year Three]={'First Prior'}>} [Written Premium])/1000)>0,'Growing',
if(
(
sum({<[Rolling Account Year Three]={'Most Recent'}>} [Written Premium])/1000 - sum({<[Rolling Account Year Three]={'First Prior'}>} [Written Premium])/1000)=00,'NM',
if(
sum({<[Rolling Account Year Three]={'Most Recent'}>} [Written Premium])=0,'Lost',
if(
(
sum({<[Rolling Account Year Three]={'Most Recent'}>} [Written Premium])/1000 - sum({<[Rolling Account Year Three]={'First Prior'}>} [Written Premium])/1000)<0,'Shrinking'))))

• ###### Re: If statement - transform from Expression to Script

What are the dimensions of the chart/table containing these expressions?

You could do something like this (add the chart dimensions for dim1, dim2 placeholders below)

```LOAD
dim1,
dim2,
if((sum({<[Rolling Account Year Three]={'Most Recent'}, [New/Renewal]={'New'}>} [Written Premium])/1000 >0
And sum({<[Rolling Account Year Three]={'First Prior'},[New/Renewal]={'New'}>} [Written Premium])/1000=0),'New'
) as Expr1,
...expr2 here... as Expr2
Resident ...
GROUP By
dim1,
dim2
```

And do the same for the second expression.