Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikView forum consolidation is complete. Labels are now required. LEARN ABOUT LABELS
cancel
Showing results for 
Search instead for 
Did you mean: 
stjernvd
Partner
Partner

Percentage change between days

Hi All,

I would like to calculate the percentage change in the script between stock value on different days.

Here is my original data:

Excel Data.PNG

What would be a good expression for doing this? I tried this expression but it doesn't work:

FirstSortedValue(Day,Stock Value) - Above(FirstSortedValue(Day,Stock Value) / Above(FirstSortedValue(Day,Stock Value)

Does this make sense?

1 Solution

Accepted Solutions
maxgro
MVP
MVP

like this?

1.png

source:     // replace with your data

load

  date(makedate(2015) + rowno() -1) as Day,

  floor(rand()*10) as Value

AutoGenerate

  365;

final:

load

  Day,

  Value,

  Peek(Value) as PrevValue,

  (Value - Peek(Value)) / Peek(Value) as Change%

Resident source

order by Day;

View solution in original post

5 Replies
maxgro
MVP
MVP

in script or in chart?

if in chart what's the expression for 2nd column (stock value)?

stjernvd
Partner
Partner

Stock Value is just a number...no expression for it...same with day...the data above is from my excel file...

I want to edit it in the script if possible..to load the percentage change of stock value from day to day as 'growth rate'....

maxgro
MVP
MVP

like this?

1.png

source:     // replace with your data

load

  date(makedate(2015) + rowno() -1) as Day,

  floor(rand()*10) as Value

AutoGenerate

  365;

final:

load

  Day,

  Value,

  Peek(Value) as PrevValue,

  (Value - Peek(Value)) / Peek(Value) as Change%

Resident source

order by Day;

View solution in original post

stjernvd
Partner
Partner

Yes thank you very much!

maxgro
MVP
MVP

I think you can do that in chart too; if sum(val) is expression, and the chart is day ordered, above(sum(val))