2 Replies Latest reply: Oct 29, 2012 10:32 AM by Gerhard Laubscher

# Error in Expression Value

Hi There,

In my load script I have an expression like this:

if([Champion Challenge No] = 28 or [Champion Challenge No] = 31,round([Value of first purchase]/20,0.01),

if([Champion Challenge No] = 29 or [Champion Challenge No] = 32,round([Value of first purchase]/10,0.01), 0)) as [PQ First Purchase Discount],

This means that certain people qualify for a 10% or 5% discount on their first purchase.

Then I have a table where I want to check that the system is correctly posting the expected discount.

Expression 1 is my EXPECTED Discount:      =[PQ First Purchase Discount]

Expression 2 is the actual discount posted     =sum([Trans Amount])*-1

Expression 3 I want to use to look for accounts where the correct discount did not post. So I want to subtract the two expressions from each other, and I am expecting zero values. If teh value is zero I want the field left blank, and otherwise I want to see the value. SO my expression looks like this:

=if([PQ First Purchase Discount]-(sum([Trans Amount])*-1)=0,'',[PQ First Purchase Discount]-(sum([Trans Amount])*-1))

But for some reason, I sometimes do not get a zero value when I subtract the expression, even though the values are the same. See the image attached.

Any ideas?

Gerhard

• ###### Re: Error in Expression Value

Try rounding that substraction first:

=if(round([PQ First Purchase Discount]-(sum([Trans Amount])*-1),0.01)=0,'',[PQ First Purchase Discount]-(sum([Trans Amount])*-1))

• ###### Re: Error in Expression Value

Nice, thank you.

Still don't understand it... but it works.

G