Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Highlighted
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
Valued Contributor II

Re: Compare dates values

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
New Contributor II

Re: Compare dates values

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
Honored Contributor III

Re: Compare dates values

Hi,

Dimension Product

Expression

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

Regards,

Antonio