Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
pedlopes
New Contributor III

running sum Load data

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

Tags (1)
1 Solution

Accepted Solutions

Re: running sum Load data

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;

2 Replies

Re: running sum Load data

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;

pedlopes
New Contributor III

Re: running sum Load data

Thanks Sunny It's work.

Community Browser