cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple If Condition is not working in Calculated column

former_member184624
Participant
0 Kudos

Hi HANA Experts,

I am writing the multiple IF conditions in the calculated column.

IF("0DISTR_CHAN"= 'ES' OR "0DISTR_CHAN"= 'OL', "WY_RKF0011_WRYCWR06_CKF", 
IF("0DISTR_CHAN"= 'RE' OR "0DISTR_CHAN"= 'EX', "INVOICED_SALES_FREECUR", ''))
The system is giving the error message as Expression is not valid: Evaluator: type error in expression evaluator;if("0DISTR_CHAN" = 'ES' or "0DISTR_CHAN" = 'OL', "WY_RKF0011_WRYCWR06_CKF", [here]if("0DISTR_CHAN" = 'RE' or "0DISTR_CHAN" = 'EX', "INVOICED_SALES_FREECUR", ''))(calculationNode (finalAggregation) -> attributes -> attribute (Invoiced_Sales) -> expression)
Can you pls help on this error.Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Abhishek_Hazra
Active Contributor
0 Kudos

Hi jelina.masilamani ,

Can you try like below?

IF(("0DISTR_CHAN"= 'ES' OR "0DISTR_CHAN"= 'OL'), "WY_RKF0011_WRYCWR06_CKF", IF(("0DISTR_CHAN"= 'RE' OR "0DISTR_CHAN"= 'EX'), "INVOICED_SALES_FREECUR", ''))

Best Regards,
Abhi
former_member184624
Participant
0 Kudos

Thank you for your message.

I tried with your code in calculated column and getting the below error message.

Error Message

Repository: Encountered an error in repository runtime extension;Model inconsistency. Create Scenario failed:

Expression is not valid: Evaluator: type error in expression evaluator;if("0DISTR_CHAN" = 'ES' or "0DISTR_CHAN" = 'OL', "WY_RKF0011_WRYCWR06_CKF", [here]if("0DISTR_CHAN" = 'RE' or "0DISTR_CHAN" = 'EX', "INVOICED_SALES_FREECUR", ''))(calculationNode (finalAggregation) -> attributes -> attribute (Invoiced_Sales) -> expression)

Abhishek_Hazra
Active Contributor
0 Kudos

Your screenshot shows you ofcourse have not tried my syntax, look again the first expression is missing the braces. You can simply copy what I have written.

BR,
Abhi

former_member184624
Participant
0 Kudos

Hi Abhi,

I copied the code and click on validate and save the changes. I am wondering, how it is not saving. I have deleted the calculated column and created with your code. But still same error. Do i need to clear anything. Pls suggest.

Error Message

Repository: Encountered an error in repository runtime extension;Model inconsistency. Create Scenario failed:

Expression is not valid: Evaluator: type error in expression evaluator;if("0DISTR_CHAN" = 'ES' or "0DISTR_CHAN" = 'OL', "WY_RKF0011_WRYCWR06_CKF", [here]if("0DISTR_CHAN" = 'RE' or "0DISTR_CHAN" = 'EX', "INVOICED_SALES_FREECUR", ''))(calculationNode (finalAggregation) -> attributes -> attribute (invoiced_Sales) -> expression)

The following errors occurred: Inconsistent calculation model (34011)

Details (Errors):

- calculationNode (finalAggregation) -> attributes -> attribute (invoiced_Sales) -> expression: Expression is not valid: Evaluator: type error in expression evaluator;if("0DISTR_CHAN" = 'ES' or "0DISTR_CHAN" = 'OL', "WY_RKF0011_WRYCWR06_CKF", [here]if("0DISTR_CHAN" = 'RE' or "0DISTR_CHAN" = 'EX', "INVOICED_SALES_FREECUR", '')).

former_member184624
Participant
0 Kudos

Hi Abhi,

As i checked, the code is reflected but still it is showing same error. I changed from Column engine to SQL.

Error Message

Repository: Encountered an error in repository runtime extension;Model inconsistency. Create Scenario failed:

sql expression is not valid: 'IF(("0DISTR_CHAN"= 'ES' OR "0DISTR_CHAN"= 'OL'), "WY_RKF0011_WRYCWR06_CKF", IF(("0DISTR_CHAN"= 'RE' OR "0DISTR_CHAN"= 'EX'), "INVOICED_SALES_FREECUR", ''))' : Unregistered function name: "if"(calculationNode (finalAggregation))

The following errors occurred: Inconsistent calculation model (34011)

Details (Errors):

- calculationNode (finalAggregation): sql expression is not valid: 'IF(("0DISTR_CHAN"= 'ES' OR "0DISTR_CHAN"= 'OL'), "WY_RKF0011_WRYCWR06_CKF", IF(("0DISTR_CHAN"= 'RE' OR "0DISTR_CHAN"= 'EX'), "INVOICED_SALES_FREECUR", ''))' : Unregistered function name: "if".

Abhishek_Hazra
Active Contributor
0 Kudos

No, it is not same error, if you check the new screenshot you have provided, this time you got a new error that says unregistered function 'if', which means you are using sql engine instead of column engine, change the engine to column in your calculated column definition, it will work.

BR,
Abhi

former_member184624
Participant
0 Kudos

Hi Abhi,

I solved this problem. The data type of this calculated column is measure and i have given space in the else condition. I just included zero and it is working fine.

IF(("0DISTR_CHAN"= 'ES' OR "0DISTR_CHAN"= 'OL'), "WY_RKF0011_WRYCWR06_CKF", IF(("0DISTR_CHAN"= 'RE' OR "0DISTR_CHAN"= 'EX'), "INVOICED_SALES_FREECUR", 0))
Abhishek_Hazra
Active Contributor
0 Kudos

Good, that was not possible to know from your original problem statement. However it had the syntactical error the correction of which I provided, please consider closing the question with due acknowledgement.


Best Regards,

Abhi

Answers (0)