Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
gerhardl
Contributor II

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

Tags (2)
1 Solution

Accepted Solutions

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))


talk is cheap, supply exceeds demand
2 Replies

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))


talk is cheap, supply exceeds demand
gerhardl
Contributor II

Re: Error in Expression Value

Nice, thank you.

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

G

Community Browser