Skip to Content

Multiple Nested "IF" statements in a Calculated Column

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Mar 01, 2017 at 08:17 PM

    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

    Add comment
    10|10000 characters needed characters exceeded