Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
I have a data sets with different dates.
I'd like to compare values coming from 2 different dates, for instance:
Product | Date | Values |
---|---|---|
Apples | 20/5/2017 | 15000 |
Pears | 20/5/2017 | 3000 |
Carrots | 20/5/2017 | 60000 |
Apples | 27/5/2017 | 45000 |
Pears | 27/5/2017 | 6000 |
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
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.
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
Hi,
Dimension Product
Expression
FirstSortedValue(Values,-Date)-FirstSortedValue(Values,Date)
Regards,
Antonio