cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP IBP Key figure with IF NESTED Calculation

1,271

Hi,

I have a if nested key figure calculation with as below.

Depending on the attribute CUSTID, the key figure QUANTITYTOTAL is divided into either Keyfigure1 or (Keyfigure2+Keyfigure3).

It works fine:

IF(UPPER("CUSTID") =''BP1010', "QUANTITYTOTAL@ZMATLOCDIVCUST" / "Keyfigure1@ZMATLOCDIV", IF(UPPER("CUSTID")=''BP1710'',"QUANTITYTOTAL@ZMATLOCDIVCUST" / ("Keyfigure2@ZMATLOCDIV" + "Keyfigure3@ZMATLOCDIV"),NULL))

But I also have to make sure that Keyfigure1 and (Keyfigure2+Keyfigure3) are not empty or zero to avoid dividing by 0 or NULL.

IF((UPPER("CUSTID")=''BP1010''), (IF(ISNULL("Keyfigure1@ZMATLOCDIV") OR "Keyfigure1@ZMATLOCDIV"=0, 0, ("QUANTITYTOTAL@ZMATLOCDIVCUST" / "Keyfigure1@ZMATLOCDIV"))), (IF((UPPER("CUSTID")=''BP1710''), (IF(ISNULL(("Keyfigure2@ZMATLOCDIV" + "Keyfigure3@ZMATLOCDIV")) OR ("Keyfigure2@ZMATLOCDIV" + "Keyfigure3@ZMATLOCDIV")=0)), 0,"QUANTITYTOTAL@ZMATLOCDIVCUST" / ("Keyfigure2@ZMATLOCDIV" + "Keyfigure3@ZMATLOCDIV"), NULL)))

The check of planning area is ok, but I get a error message with the planning area activation.

SQL Message: column store error: fail to create scenario: [34011] Inconsistent calculation model;calculationNode
expression: Expression is not valid: Evaluator: wrong number of function arguments;wrong number of args to if,fixed

How do I need to write the IF Nested Calculation, so it would work?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

riyazahmed_ca2
Contributor

Hi Kenon,

Please check the below code.

IF(UPPER("CUSTID")=''BP1010'', IF(ISNULL("Keyfigure1@ZMATLOCDIV") OR "Keyfigure1@ZMATLOCDIV"=0, 0, "QUANTITYTOTAL@ZMATLOCDIVCUST" / "Keyfigure1@ZMATLOCDIV"),IF(UPPER("CUSTID")=''BP1710'',IF(ISNULL("Keyfigure2@ZMATLOCDIV" + "Keyfigure3@ZMATLOCDIV") OR ("Keyfigure2@ZMATLOCDIV" + "Keyfigure3@ZMATLOCDIV")=0, 0,"QUANTITYTOTAL@ZMATLOCDIVCUST" / ("Keyfigure2@ZMATLOCDIV" + "Keyfigure3@ZMATLOCDIV")), NULL))

Best Regards,

Riyaz

Answers (0)