Linear regression trend lines can be shown in QlikView bitmap charts by means of the Trendlines option in the Expressions page of Chart Properties. It is also possible to display the regression equation.
If you want to display the regression data in e.g. a table chart, the regression must be calculated. The LINEST_M and LINEST_B aggregation functions will give you the required slope and y-intercept values of the linear regression. The LINEST_M and LINEST_B aggregation functions always correspond to a continuous x-axis, which means that you have to make this setting on the Axes tab of the chart properties.
To calculate correctly, these functions need to have the entire chart aggregation (expression iterated over dimension) as input. This can be achieved by defining an advanced aggregation function containing the same base expression and dimensions as the containing chart. The advanced aggregation function is then used as parameters to the LINEST aggregations. The resulting expression could look like follows:
linest_M(total aggr(TransVal,TransID),TransID)*TransID + linest_b(total aggr(TransVal,TransID),TransID)
function is implied around all occurrences of
Note that the trend line here is not a traditional QlikView trend line, but a regular expression plotted as line. You can see the difference from the fact that the expression plot, as opposed to a traditional trend line, is not extrapolated outside the first and last data points.
This chart can converted to a straight table:
The following expressions are used, in order of appearance: