### Title

calculation with if and value list items

### Post

Hi. I'm obviously new to all that but i learn everyday.

I'd like to know if i can do this and if yes, what would be the good syntax.

In the same table, I have a value list called products_types and let's say there's 2 values in it: type A and type B. (drop-down)

And I have, for example, 4 fields with price values: price 1, price 2, price 3, price 4.

And finally a calculation field called Total.

What I want is that:

If I choose type A in products_types, then total = price 1 + price 2

If I choose type B in products_types, then total = price 2 + price 3

And so on...

Is that possible?

Thanks

Use the Case function in your Total field calculation:

Case (

products_types = "type A" ; price_1 + price_2 ;

products_types = "type B" ; price_2 + price_3 ;

"" )