Adding Reference Lines to trendline charts

One cannot overstate the importance of adding context to analysis. Take the example of having the headline number Average Call Time displayed on a dashboard. While this might clearly be an important metric for a call center, but on its own it portrays very little. As shown in the Dimensionless bar chart recipe in the preceding section, we used reference lines to add the context required to make the number meaningful. Sticking to the example of Average Call Time, we may also want to see alongside; a previous point in times position, the national or a competitor's average, the internal target, and so on. This recipe extends the use of reference lines further.

Getting ready

For this recipe, we will make use on inline data load which gives us the call bounce rates for different periods. Add the following code into the data load editor and reload the Qlik Sense application:

WebStats:
LOAD * INLINE [
    Period, BounceRate
    1, 0.26
    2, 0.25
    3, 0.24
    4, 0.24
    5, 0.27
    6, 0.28
    7, 0.21
    8, 0.34
    9, 0.24
    10, 0.25
];

How to do it…

  1. Add a line chart object onto the content page.
  2. Add Period as a dimension.
  3. Add AVG(BounceRate) as a measure.
  4. From the Properties panel | under Add-ons click on the Reference lines button and then on Add reference line
  5. Set the Label as Upper Threshold and set the Reference line expression to the following:
    =Avg(BounceRate)+Stdev(Total Aggr( Avg(BounceRate),Period))
  6. Set the color to red.
  7. Click Add reference line again, this time setting the label to Lower Threshold and the expression:
    =Avg(BounceRate)-Stdev(Total Aggr( Avg(BounceRate),Period))
  8. Set the color to yellow.
  9. Click Add reference line for a third time and set the label to Average and the expression to:
    =Avg(BounceRate)
  10. Set the color to green.
  11. The final visualization should resemble the following image:
    How to do it…

How it works…

The preceding chart is often referred to as a Statistical Process Control (SPC) chart. The upper and lower threshold reference lines set a boundary of normal operation. Data points that fall outside of these reference lines differ from the norm and are highlighted as such. The upper and lower limits are simply the average plus or minus the standard deviation. We use the Aggr function to "pre-calculate" the average over the period dimension and then apply the Stdev function to this number.

Definition: Standard deviation (represented by the symbol sigma, s) shows how much variation or "dispersion" exists from the average (mean) or expected value. A low standard deviation indicates that the data points tend to be very close to the mean; high standard deviation indicates that the data points are spread out over a large range of values:

http://en.wikipedia.org/wiki/Standard_deviation

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset