Skip to main content

Hello community!

I am looking to display the amount of an hour of additional service to be applied to a price depending on the type of service (A, B, C or D).

This number of hours can be 0, 1 or 2.

I have already created a column that automatically displays the number of hours to be invoiced (0, 1 or 2).

I have already created a column that automatically displays the type of service (A, B, C or D).

Here are the possible scenarios :

- If my hours column displays 0h and the product type is A, B, C or D, then display 0 €
- If my hours column displays 1h or 2h, and the product type is A, then display 10 €
- If my hours column displays 1h or 2h, and the product type is B, then display 20 €
- If my hours column displays 1h or 2h, and the product type is C, then display 30 €
- If my hours column displays 1h or 2h, and the product type is D, then display 40 €

Can you help me please ?

 

 

IF(
hours,
SWITCH(
{Product Type},
"A", 10,
"B", 20,
"C", 30,
"D", 40
), 0
)

 

 

Here's how that breaks down. The IF() function will execute the SWITCH() function only if the {hours} field returns a non-zero number (non-zero numbers are considered to be truthy; i.e. equivalent to True); otherwise it defaults to an output value of 0.

The SWITCH() function creates specific output based on the option chosen in the {Product Type} field.


Just perfect, thank you ! @Justin_Barrett !!


Reply