How to build Trend Lines and Forecasting in Qlik
- Igor Alcantara
- Jun 27
- 1 min read
This video shows how to add trend lines and forecasting lines in Qlik even if this option is not available in your version of Qlik. It works with all Qlik Analytics products, from QlikView to Qlik Cloud.
👍 If you appreciate this video, like it and share it.
🔍 Follow us:
Our Youtube: https://www.youtube.com/@datavoyagers
Our Store: https://www.datavoyagers.net/store
Code Library
Qlik Script
ProductionDemmand:
Load *, 0 As FutureFlag Inline [
Day, Units
1, 143
2, 152
3, 161
4, 139
5, 137
6, 174
7, 142
8, 141
9, 162
10, 180
11, 164
12, 171
13, 206
14, 193
15, 207
16, 218
17, 229
18, 225
19, 204
20, 227
21, 223
22, 242
23, 239
24, 266
];
Let vFutureDays = 21;
Let vLastDay = Num(Peek('Day', -1, 'ProductionDemmand'));
Concatenate(ProductionDemmand)
Load
$(vLastDay) + RecNo() As Day,
1 As FutureFlag
AutoGenerate $(vFutureDays);
Expressions
Actual
If(FutureFlag = 0, Sum(Units))
Trend
If(FutureFlag = 1,
RangeAvg(Above(TOTAL
If(FutureFlag = 0, Sum(Units)), 0, $(vFutureDays) ))
, If(FutureFlag = 0 And Day = $(vLastDay), Sum(Units))
)
Upper Limit
If(FutureFlag = 1,
RangeAvg(Above(TOTAL If(FutureFlag = 0, Sum(Units)), 0, $(vFutureDays)))
+
1.96 * RangeStdev(Above(TOTAL If(FutureFlag = 0, Sum(Units)), 0, $(vFutureDays)))
)
Lower Limit
If(FutureFlag = 1,
RangeAvg(Above(TOTAL If(FutureFlag = 0, Sum(Units)), 0, $(vFutureDays)))
-
1.96 * RangeStdev(Above(TOTAL If(FutureFlag = 0, Sum(Units)), 0, $(vFutureDays)))
)
Commentaires