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.
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.
Hi,
I d'ont really understand your need.
How are your data when you load it, and what do you expect to do in the script exactly ?
it is from excel file. i loaded it.. and it has a lot of sheets.. so there is a for loop inside..
I have a field I need to compute. As I have said above, the results should be like this:
ID Value Value1
1 1000 0
1 2000 1000
1 500 -1500
2 100 0
2 200 100
Hi,
Try this expression in Value
above([Value])-[Value]
use this expression ,u get result
Hi, I will try this in the expression, but I prefer it in the script
You can use this :
If(Peek(ID)=ID,
Value-Peek(Value),0) as Value1,
Make sure your data are ordered by ID.
I will try this one, can you give me an example if possible? thank you
I tried your computation, yes it is working but the first value should be the one with the '-'
bump.
bump