Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare dates values

Hello all,

I have a data sets with different dates.

I'd like to compare values coming from 2 different dates, for instance:

ProductDateValues
Apples20/5/201715000
Pears20/5/20173000
Carrots20/5/201760000
Apples27/5/201745000
Pears27/5/20176000

Result

Difference from 20/5 to 27/5:

Apples: + 30000

Pears: + 3000

Carrots: none

Do you have a solution (either in script or expression)?

Many thanks in advance,

Nicolas

3 Replies
eduardo_dimperio
Specialist II
Specialist II

Hi Nicoals,

If you have only two dates you can get the maximum date Max(date) - minimum date Min(date), that works in script chart. But if you have more than one date i suggest to use peek() function.

If you need help to write the code please let me know.

viniciusmariano
Contributor II
Contributor II

Hello,

In addition for Eduardo answer, you could process the table in the script:
1) Loading data ordering by Product and Date;

2) Processing balance using Peek(), something like:

Load *

         Values - Peek(Values) as Values2

Resident ...

Additional information in Peek ‒ QlikView

Best Regards.

Vinicius Mariano de Lima

antoniotiman
Master III
Master III

Hi,

Dimension Product

Expression

FirstSortedValue(Values,-Date)-FirstSortedValue(Values,Date)

Regards,

Antonio