Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello and Good Day, I'm currently new in QlikView and I say this is one powerful B.I Tool.
I'm still learning and I need to solve something..
I have a table
D | ID | Value | Value1 |
---|---|---|---|
D1 | 1 | 2000 | 0 |
D2 | 1 | 3000 | 1000 |
D3 | 2 | 2000 | 0 |
D4 | 2 | 1500 | -500 |
D5 | 2 | 500 | -1000 |
D6 | 3 | 1000 | .. |
I need to compute for Value1 depending on the ID.
The computation is d2-d1, d4-d3, d5-d4
I find it hard to explain, but I just need to compute for Value1 depending on the next Value.
Thank you and Good Day.
P.S This is for scripting Thank you.
my problem is like this http://community.qlik.com/message/240999
but i need to compute base on the ID
I tried your computation, yes it is working but the first value should be the one with the '-'
I don't understand this requirement. Can you explain more or share data ?
It seems that my data peeks in other rows, i don't know why it works like that.
attached file is what i'm testing..
Hi,
use Previous() to access the last row.
LOAD
D,
ID,
Value,
Value - Previous( Value ) as Value1
FROM
Source
ORDER BY
D;
Hi,
There are several functions in qlikview to get the values from the previously loaded rows.
Try out Previous and peek functions. you can find beautiful descriptions from QlikView Help Menu or Press F1.
Hope this helps.
Regards
Andrew Hudson
thank you for replies
alhough i'm still having problem regarding my data.
I think the problem is because there is a date field. I have attached my .qvw, you can check it out.
Thanks
bump.
Hello,
from
if([Plate Number] = Peek([Plate Number]), [Odometer Reading] - Peek([Odometer Reading],0)) as peek
why Peek([Odometer Reading],0))?
Do you really want substract the first value from the table in every row?
left join(A)
LOAD
Date,
Time,
if([Plate Number] = Previous([Plate Number]), [Odometer Reading] - Previous([Odometer Reading])) as new_peek
Resident
A
Order by Date, Time;
I have an expample enclosed.
Wow thank you very much!
I would try to apply it now to my work. Thanks
edit : didin't see you had a correct answer before...