cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating on multiple prices

0 Kudos

Hello,

I am trying to calculate a value on multiple prices, so what i mean is for e.g

0 - 10 Cost $10

11 - 20 Cost $15

21 - 30 Cost $20

So someone who has bought 15 units should be charged the first 10* $10 then 5 * $15, different bracket prices.

Someone who bought 27 units would be charged $10 for the first 10, $15 for the second 10, and lastly $20 for the remaining 7


how is that doable in SAC? Best Regards.

0 Kudos

Thanks for the reply, is it possible to implement this kind of functionality, but had the $ value be changeable in a table for what if scenarios?

DebjitSingha
Active Contributor
0 Kudos

Yes, you can let cell as data input cell and table functionality will calculate based on formula. Beside you can use variables at the model level if you are indented to provide a separate screen for data input (instead of same table with output)

0 Kudos

looking at the formula, can you explain how it will calculate the price of 27 units sold to be 320? wont units sold above 10 always have a price of 10?

DebjitSingha
Active Contributor
0 Kudos

zanki that was a typo (should be <=10 AND >= 0). I tried to add snapshots to help with the navigation. I guess you got the point. 🙂

Though the goal was to show how and where the formula can be written with respect to your requirement. You may have other requirements and need to change the code accordingly.
Update impages.
-D

DebjitSingha
Active Contributor
0 Kudos

zanki Has your question been answered correctly? If so, it is much appreciated by the community if you clicked "accept" on the answer which helped you the most. For more information please see this tutorial: Ask and Answer Questions on SAP Community

Accepted Solutions (1)

Accepted Solutions (1)

DebjitSingha
Active Contributor

hello zanki,

Here is the revised version of the solution with formula applicable to your scenario.

I suggest adding KF in Account dimensions, at least 2 -

  1. unit sold
  2. Final Cost/ Charge

IF([Unit_Sold]>30,
        (390+([Unit_Sold]-30)*20),
        IF([Unit_Sold]>=21 and [Unit_Sold]<=30,
                250+([Unit_Sold]-20)*20,
                IF([Unit_Sold]>=0 and [Unit_Sold]<=10,
                        [Unit_Sold]*10,
                        0
                )
        )
)

Please note that you can not define aggregation type on KF with formula. It take the same format as of source fields.

Hope you find above information helpful, appreciate if you accept this as best answer (option available below this response). This in-turn help others searching for similar stuff.

Viewers - If you find above information helpful, feel free to up-vote.

Thanks,

Debjit

DebjitSingha
Active Contributor
0 Kudos

Excel frmula in case you want to test the logic in excel. D9 is the input cell with units sold-

=IF( D9>30, (390+(D9-30)*20),IF(AND(D9>=21,D9<=30),250+(D9-20)*20,IF(AND(D9>=0,D9<=10),D9*10,0)))

Answers (0)