Skip to Content
avatar image
Former Member

Conditional Calculations for Keyfigure

Hhello team,

We have a priority requirement to create custom key-figures calculations.

One such is Process Loss key figure. Which is a simple subtraction between Material Consumed - Material Produced. Both are at 'Location-Product' planning level and the product master data will be having both finished good and raw material. Below are the sample data for reference

As per the straight forward calculation, Process loss = material consumed - material product. But the material consumed kf will NOT be valid for a Finished good and it will have NA. So the resultant Process Loss would be NA-100

Question 1: Can i write a conditional key figure caluclation and somehow tell to system that consider the Material Consumed kf only for 'raw material' product attriobutes

Question 2: if i can change the kf base planning levels from Location-Product to Location-Product type etc ? Can that work?

Please advice gurus

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    May 02, 2017 at 11:12 PM

    Hi Venkat,
    You can check for material type condition while calculating KF ProcessedLoss and system will calculate only for that combination.
    Ex: Processed Loss = if("MATTYPE"='FG',"Produced-Consumed")


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello UjwalKumar,

      Thanks a ton for writing back, felt like a i found a light :)

      The thing is we consume 'Raw water' say 100 mega liter to produce 90 mega liter of 'Treated water'. Now we lost 10 ml in this production process aka Process Loss.

      But if we write a straight formula called , Process loss = Material consumption - Material Production, we get the below crazy values

      I followed your inputs. Wrote the below calculation and kept a condition on the Product ID = Treatedwater

      But i got the below error

      Where i'm getting the formula wrong.

      Question: Even with this approach, how i can mandate the system to look for consumption values only for Raw WATER. Please help

  • avatar image
    Former Member
    Apr 29, 2017 at 04:35 PM

    I need to do a conditional Key-Figure calculation based on specific attribute values. So i found the below solution


    1) Wrote a Local member Keyfigure,

    2) Did my calulcations

    3) Copy the results on a stored keyfigure


    How to copy the local member values on to the Stored Key Figure ?

    Add comment
    10|10000 characters needed characters exceeded

  • May 03, 2017 at 04:23 PM

    Hi Venkat,

    If I understand correctly you are trying to do something like below. So instead of putting condition on attribute value maintain product type as NULL (meaning no value) and RW (Raw Water) for product for which you don't want calculation to happen.

    Then ProcessLossKF = if(ISNULL("PRDTYPE"),"MATCONS"-"MATPROD")



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      hello again ujwal,

      Thanks for your persistence on this.

      i think i didn't explained it properly. The subtraction has to happen from one attribute value to another attribute.

      So as per your above input, ProcessLossKF = if(ISNULL("PRDTYPE"),"MATCONS"-"MATPROD")

      This will restrict the calculation only to a Product type of Null...but i want to consider the value of Mat Consumed NOT for the existing planning level combination, but for another.

      Business Context: To give more business feel to this scenario, Planning happens in IBP...production happens in SAP S4 PP...Actual's will be recorded there in S4 and will be sent back to IBP via HCI.

      Naturally, like every other business, even our client has reporting requirement (Control Tower) to capture the Plan vs Actual aka Variances and do some gimmicks with the numbers. Above is one such scenario... i consumed X -> produced Y..what is X-Y.

      Please help me with this...

      Appreciate your time on this