Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

chrisbrain
Valued Contributor

Charting delta/difference between adjacent data points

This sounds like it should be easy but I can't quite see how/where to do it.

Lets say I have a simple line chart plotting day vs number of likes on a Facebook page - what I would like to plot is actually day vs the change in number of likes since the previous day (or data point).

Is there a way I can describe this in the expression?

1 Solution

Accepted Solutions
Not applicable

Charting delta/difference between adjacent data points

Hi  Chris,

  Try this : take Time in the dimension and

   Value-above(Value)

   for the expression in a line chart.

This might give you an insight on the change.

Regards,

-Karthik

4 Replies
Not applicable

Charting delta/difference between adjacent data points

Hi Chris,

    Can  we have a sample of your data set?

Assuming the data set to be the following :

        

      FB_Data:

       Day     Likes

          1          10

          2          30

          3          34

          4          39

So, on plotting this on a line chart, it would be simple as you told.

When you load the above data like this :

Load

Day,

Likes,

if(isNull(peek(Likes)),Likes,peek(Likes)) as Change

Resident

FB_Data;

and plot the graph Day vs Change, probably you might get your solution.

Am not able to test this right now, but hope this should work.

Check and revert back.

Regards,

-Karthik

chrisbrain
Valued Contributor

Charting delta/difference between adjacent data points

Hi,

Thanks for the initial hints.

I would like to solve this outside of the loadscript if possible, 2 main reasons:

- I think the above would rely in the data being loaded in the correct order I needed for the chart.

- I would have to add this load script for every field I wanted this for.

I tried using the peek method in the expression value for the chart but I don't think it's available there.

So I am still stuck - here is some sample data as requested.

Time     Value

01/08/2011 14:11          19209

01/08/2011 15:16          19213

01/08/2011 16:11          19217

01/08/2011 17:11          19216

01/08/2011 18:11          19219

01/08/2011 19:11          19222

01/08/2011 02:11          19193

01/08/2011 20:11          19222

01/08/2011 21:11          19227

01/08/2011 22:11          19231

01/08/2011 23:11          19231

01/08/2011 03:11          19193

01/08/2011 04:11          19194

01/08/2011 05:11          19197

01/08/2011 06:11          19197

01/08/2011 07:11          19198

01/08/2011 08:11          19197

01/08/2011 09:11          19197

02/08/2011 00:11          19233

02/08/2011 01:11          19233

Any further hints greatly appreciated!

Not applicable

Charting delta/difference between adjacent data points

Hi  Chris,

  Try this : take Time in the dimension and

   Value-above(Value)

   for the expression in a line chart.

This might give you an insight on the change.

Regards,

-Karthik

chrisbrain
Valued Contributor

Charting delta/difference between adjacent data points

Hi,

Thanks - that seems to work in a simple example, e.g. where I have:

LOAD * INLINE [

    F1, F2

    1, 1000

    2, 1002

    3, 1004

    4, 1010

    5, 1005

    6, 1006

    7, 1002

    8, 1001

    9, 1001

];

And then plot F1 vs F2-Above(F2).

Still getting strange results in my real example where I have 2 dimensions:

Date, TwitterAccount

vs

=followers_count - Above(followers_count)

But I might need to look into this my side a little more.

Thanks!

Community Browser