Minus if

Hi, I have an enum type column called “method” in a table called “order”

[Method] has two values “pick up” and “delivery”.


[Delivery Fees] column has a value for delivery charge.

[Item price] column has a value of the item price.

[Order Total] column auto calculates the total. (delivery fees + items price)

NOW my question is I want a way if the method column is set to “pick up” then it reduces the value of the delivery fees.

Here is the pseudocode how it might be in [order total] column formula:

[Item price]+[Deliver Fees]

And

If [Method] = Pick up

Minus

[Delivery Fees]

Any help plz

Just convert it as formula in computed column total :

If([Method] = “Pick up”, [Item price]-[Deliver Fees], [Item price]+[Deliver Fees])

1 Like

[Item Price] + IFS(
[Method] = “Pick up”, -[Delivery Fees],
TRUE, [Delivery Fees]
)

1 Like

@Vincent_P

Hi, the formula is ok

If([Method] = “Pick up”, [Item price]-[Deliver Fees], [Item price]+[Deliver Fees])

But If I select delivery and then change to pick up, it still add the delivery fees.

logically, the calcul is done where field lost focus. So if you change [Method] calcul is not done, but if you click on other field like price, [order total] must be updating

Thanks @Vincent_P but nothing changed

@Vincent_P

Here it is, no need for the - [Deliver Fees]. Now it works.

If([Method] = “Pick up”, [Item price], [Item price]+[Deliver Fees])