cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Nested "IF" statements in a Calculated Column

0 Kudos

Hello,

I am having an issue with a calculated column and multiple IF statements. Is there any way in HANA Studio to have multiple IF statements (not nested) in a calculated column? As an example,

(Line 1) if(<blah, blah, blah>)

(Line 2) and if(<blah, blah, blah>)

Much the same structure as a multiple statements in a column filter.

My root issue is that I am having problems with my nested IF statements (currently 4).

I appreciate any thoughts on this matter,

Jared

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor

First of all I think you should show the error/the issue you get using the nested if. Maybe it can be solved here.

Regarding your question: Multiple "not nested" if statements can be used in case they are enclosed in an outer if function. The reason is that the calculated column expression has to return one value. If you would not use that outer if function, you can only use not nested if functions to return a boolean value in form of 0 and 1.

Example for boolean return value in form of 0 and 1:

if(1=1,1,0) and if(2=2,1,0)

-- result is 1, cause both if functions evaluate to true (1)

Example with outer if function to return a specific value:

if(if(1=1,1,0) and if(2=2,1,0),'ok', 'not ok')

-- result is 'ok', cause both functions evaluate to true (1)

Of course you have to replace the conditions with something meaningful.

Regards,
Florian

Answers (0)