# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikView Fans! We’d love to hear from you.
Rules, plus terms and conditions, can be found here.
Not applicable

## Create an expression for calculating On Time In Full

Hi,

I have done my first simple QW report to measure Delivery Performance for my Suppliers. As a first attempt I did a simple if expression that compared confirmed date with Good receit date. This works fine and looks as follows:

If

((ConfirmedDate-GRdate) >0, 0, 1) as DP,

Basically this will mean that all early deliveries will be measured as on time. I would now like to alter that expression so that it provides an On Time measure with no tolerance for early deliveries. My attempt was as follows:

If

((ConfirmedDate-GRdate) >0, 0, 1
OR
IF((ConfirmedDate-GRdate) <0, 0, 1)) as DP,

I have obviously done something stupid... Could you give me advice on how to correct or maybe give me an alternative solution?

As an extension to this I would also like to add an expression that also take into account the quantity delivered. I would like to do it with an expression containing AND as follows:

Kind regards

Henrik

1 Solution

Accepted Solutions
Contributor

## Re: Create an expression for calculating On Time In Full

With  no fault tolerence you can do something like this.

1: If ((ConfirmedDate-GRdate)=0, 1) as DP,

2: If ((ConfirmedDate-GRdate)=0 AND (GRquantity - OrderQuantity=0), 1) as DP,

4 Replies
Not applicable

## Re: Create an expression for calculating On Time In Full

... the AND expression I had in mind was:

AND(GRquantity=OrderQuantity)

Thanks

Contributor

## Re: Create an expression for calculating On Time In Full

With  no fault tolerence you can do something like this.

1: If ((ConfirmedDate-GRdate)=0, 1) as DP,

2: If ((ConfirmedDate-GRdate)=0 AND (GRquantity - OrderQuantity=0), 1) as DP,

Not applicable

## Re: Create an expression for calculating On Time In Full

Hello Michael,

Thank you. What if I wanted a tolerance, say +/- 1 day in the expression. Is there a function where I could use the absolute value, like in Excel: Abs(...)? Any other idea?

Thanks

Henrik

MVP

## Re: Create an expression for calculating On Time In Full

Hi

This will pass the deliveries in the tolerances defined by variables vDateTolerance and vQuantityTolerance:

If((Fabs(ConfirmedDate-GRdate) <= vDateTolerance)

And (Fabs(GRquantity - OrderQuantity) <= vQuantityTolerance), 1, 0) As DP

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein