1

I'd like to give a discount based on number of camp sessions signed up for: 2-3 sessions get a 5% discount; 3 or more sessions get a 10% discount. I tried the following formula:

=(if TotalNumberOfSessions > 3 then -0.1 else if TotalNumberOfSessions > 1 then -0.05 else 0) *TotalNumberofSessions

but I get this error message:

Operator '>' incompatible with operand types 'String' and 'Int32' at character 26

and can't figure out what the message means.

Can you tell me the formula I need to use to calculate that?

1

You're on the right track. First, I would create a Price field (we'll call it Total Price) outside of your repeating sections. This field will sum the total price of all the camper sessions:

=CamperInformation.Sum(Sessions_Amount)

Next, create another Price field named Discount and use the .Count() function to retrieve the total number of sections and apply your discounts:

=(if CamperInformation.Count() > 3 then -TotalPrice*0.10 else if CamperInformation.Count() > 1 then -TotalPrice*.05 else 0)

As you can see, multiplying the Total Price by .10 or .05 will actually create a 10% or 5% discount off of the total. If you don't multiply them by the total, .10 and .05 are just static numbers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.