Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
t_hylander
Creator
Creator

Need to compare data with previous date

Hi,

I'd like to compare two results, which is easy.The problem is that I dont want to compare with last year or similar but with the previous record.

ex. data

date, item, number

11/06/13, 1, 140

16/06/13, 2, 133

18/06/13, 2, 50

18/06/13, 2, 60

22/06/13, 3, 98

What I want is to compare and see if the sum of the numbers on the 18nd is lower or higher than it was on the 16th.

Tried with FirstSortedValue, but cant that to really work, only works with the first value not second/third and so on...

This is how I did the code in a text-box just to get it working;

=FirstSortedValue({$<item={'2'}>}TOTAL number ,-date, 2)

..and this doesnt show anything, not even a null. If I have a '1' last it shows right but only one of the numbers and not the sum.

Is there another way to solve my problem, or is it just some syntax error?

Any help appreciated!

2 Replies
Anonymous
Not applicable

Perhaps you can do this within the script by looking at the previous record.

Have a look at this post: http://community.qlik.com/message/110317#110317

Jonathan

t_hylander
Creator
Creator
Author

I rather not do it in the script.

Tried a couple of diffrent syntaxes but does sum the two dates.

Made a quick demo, check it out.

Just too see if it works I simple threw it in a textbox. Works if I just have one value per day, but as soon I add one row with same date it wont show.

Thanks in advance!

/Tomas