Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, all
I'm tracking some information like views clicks from youtube into database. But this number comes with running sum like:
id, dim1, views
1, A, 1000
2, B, 500
3, A, 1500
4, B, 1000
....
Do you any way to when i'm load and store this data on qvd have only the gain value? like:
id, dim1, views
1, A, X
2, B, X
3, A, 500 ...the difference between 1500-1000 (dim1 =A)
4, B, 500 ...the difference between 1000-500 (dim1 =B)
....
I need to store the table like that because on the future analysis i'll need to sum this info by date or by dimension.
swuehl I see a discussion where you explain something like this. Can you help me please?
Thanks,
Pedro Lopes
Try this
Table:
LOAD * Inline [
id, dim1, views
1, A, 1000
2, B, 500
3, A, 1500
4, B, 1000
];
FinalTable:
NoConcatenate
LOAD id,
dim1,
If(dim1 = Previous(dim1), views - Previous(views), views) as views
Resident Table
Order By dim1, id;
DROP Table Table;
Try this
Table:
LOAD * Inline [
id, dim1, views
1, A, 1000
2, B, 500
3, A, 1500
4, B, 1000
];
FinalTable:
NoConcatenate
LOAD id,
dim1,
If(dim1 = Previous(dim1), views - Previous(views), views) as views
Resident Table
Order By dim1, id;
DROP Table Table;
Thanks Sunny It's work.