Hello, I need help to calculate discount under three different conditions. Please find below sample data.
Table 1 | Current Price | Current Discount |
Customer A | 10.00 | (4.00) |
Customer B | 10.00 | (4.00) |
Customer C | 10.00 | (4.00) |
Customer D | 10.00 | (4.00) |
Customer E | 10.00 | (4.00) |
Table 2 | Price Condition | Price Increase 1 | Condition Rate 1 | Price Increase 2 | Condition Rate 2 | Price Increase 3 | Condition Rate 3 |
Customer A | 1 | 2.0% | 2.0% | 4.0% | 2.0% | 5.0% | 2.0% |
Customer B | 2 | 2.0% | 25.0% | 4.0% | 25.0% | 5.0% | 25.0% |
Customer C | 1 | 2.0% | 3.0% | 4.0% | 3.0% | 5.0% | 3.0% |
Customer D | 2.0% | 4.0% | 5.0% | ||||
Customer E | 3 | 2.0% | 2.0% | 4.0% | 4.0% | 5.0% | 5.0% |
Here is the logic of how to process for each "Price Condition":
New Price = Current Price * (1+ Price Increase) for all situations. So this one is easy.
New Discount will be different based on the following:
If Price Condition = 1, then do following
Check if Current Discount is zero/null. If so, New Discount is zero/null
If Condition Rate is same or greater than Price Increase, New Discount is same as Current Discount
If Condition Rate is less than Price increase, then New Discount = Current Discount + (Condition Rate - Price Increase)*Current Price
If Price Condition = 2, then do following
Check if Current Discount is zero/null. If so, New Discount is zero/null
New Discount = (Current Price times Price Increase times Condition rate times -1)+(Current Discount)
If Price Condition = 3, then do following
Check if Current Discount is zero/null. If so, New Discount is zero/null
New Discount = Current Discount *(1 + Condition Rate)
If Price Condition = 0 or null
New Discount = Current Discount
Here is desired output table:
Output | Current Price | Current Discount | New Price 1 | New Discount 1 | New Price 2 | New Discount 2 | New Price 3 | New Discount 3 |
Customer A | 10.00 | (4.00) | 10.20 | (4.00) | 10.40 | (4.20) | 10.50 | (4.30) |
Customer B | 10.00 | (4.00) | 10.20 | (4.05) | 10.40 | (4.10) | 10.50 | (4.13) |
Customer C | 10.00 | (4.00) | 10.20 | (4.00) | 10.40 | (4.10) | 10.50 | (4.20) |
Customer D | 10.00 | (4.00) | 10.20 | - | 10.40 | - | 10.50 | - |
Customer E | 10.00 | (4.00) | 10.20 | (4.08) | 10.40 | (4.16) | 10.50 | (4.20) |
Solved! Go to Solution.
Hi anamik72,
The Output does not match with the conditions that you have provided. However tweaking 2 parts of the discount conditions gives the desired output. I have created the workflow based on the Output.
Workflow:-
Output:-
If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.
Thanks,
Abhra Mitra
@anamik72 , Here is another alternate solution to your problem. I hope this serves your purpose.