Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
New-Qlik
Creator II
Creator II

Actual and Forecast

Hellow everyone

I have a requirement in which we need to calculate actual cumulative value and forecast

Actual is coming wrt to quantity available ie for cumulative(2016072501) = sum of quality for (2016072500 + 2016072501)

                                                                                              cumulative (2016072502)= cum(2016072501) + quantity(20160725012)


Now I want that if quantity is null then calculate cumulative like cumu(2016072511) = cum(2016072510) + trend(2016072511)

this will be forecast

example

     

DateQuantityCumulativeTrend
20160725001
20160725012310
20160725023610
201607250341010
201607250451510
201607250562110
201607250672810
201607250783610
201607250894510
2016072509105510
2016072510116610
2016072511 7610
2016072512 8711
2016072513 9912
2016072514 11213
2016072515 12614
2016072516 14115
2016072517 15716
2016072518 16811
4 Replies
New-Qlik
Creator II
Creator II
Author

Cumulative I can calculate by using this

if(rowno()=1,'',Rangesum(above(Sum( Quantity),0,rowno())))

jonathandienst
Partner - Champion III
Partner - Champion III

In the load script, like this:

LOAD

  Quantity,

  Trend,

  Alt(Quantity, Trend) + Alt(Peek(Cumulative), 0) as Cumulative

FROM ...

Alt function returns the first valid numeric from its list of parameters. Similar to SQL COALESCE function (but not the same).

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
New-Qlik
Creator II
Creator II
Author

Thanks Jonathan .

My source hass just two columns i.e. date and quanltity.

I have writing cumulative expression in chart itself

if(rowno()=1,'',Rangesum(above(Sum( Quantity),0,rowno())))

is there a way I can write it into script and then I can use your expression

Alt(Quantity, Trend) + Alt(Peek(Cumulative), 0) as Cumulative

Thanks

jonathandienst
Partner - Champion III
Partner - Champion III

So you want to calculate the trend value? What sort of trend curve would you like?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein