Reference lines in Sales versus Target gauge chart

Recently, while delivering a proof of concept, I was asked by a customer if we could create a "Stephen Few Bullet chart" in Sense. This is not possible out of the box because of the simple reason being that the bullet chart involves overlaying a bar chart on top of a gauge chart and overlaying objects in Sense is not allowed. So, I thought of delivering the same result using just the gauge chart and making use of reference lines.

Getting ready

Load the following script in the Qlik Sense data load editor, it gives information about the Sales and Target values for four countries:

LOAD * INLINE [
Country, Sales, Target
USA, 10000, 8500
UK, 7000, 9500
Germany, 5000, 4500
Japan, 6000, 6000
];

How to do it…

  1. Drag across a gauge chart object onto the sheet from the Assets panel on the left.
  2. Click on Add measure and type in the following expression. Label it as Sales vs Target:
    Sum(Target)
  3. Under Add-Ons, click on the Reference lines and add a reference line expression with the following definition:
    =Sum (Sales).
  4. Label the reference line expression as Sales. Change the color of the reference line to red by clicking on the color dropdown.
  5. Under Appearance, click on Presentation and set the Max range Limit as:
    =Sum(Target)*1.2
  6. Select the representation as Bar and orientation as horizontal.
  7. Check the Use Segments box.
  8. Next, click on the Add limit button and add the following limit:
    • Segment 1:
       =Sum (Target)*0.30
       Click on the segment area to change the default color to Grey.
  9. Again, click on the Add limit button to create a second segment with the following limit:
    • Segment 2:
      =Sum (Target)*0.60
      Click on the segment area to change the default color to Red.
  10. Finally, click on the Add limit button to create a third-segment with the following limit:
    • Segment 3:
      =Sum (Target)
       Click on the segment area to change the default color to Yellow.
  11. Select the color of the last segment as Green. Check the Gradient box for the last segment.
  12. Click on How to do it… when finished.
  13. The resulting chart will look similar to the following screenshot:
    How to do it…

How it works…

The color segments signify how the sales of a particular country are performing, as compared to the target values. The red reference line indicates the sales value. The color red does not signify anything else and is used only to highlight sales. Hence, you can use any other color of your choice.

The sales can be more than the set target. Hence the Max range Limit is set to 1.2 times the target value. Due to this setting, the target value is represented by the black line at the end of the bar. Surely, sales can surpass the targets by more than 20 percent. So, the Max range figure can be altered by say to 1.5 times of the target value. One look at the graph and we can easily make out if we are in the red zone or are doing better than expected.

There's more…

A similar concept is explored in the Capventis Redmond Pie-Gauge Chart designed by Stephen Redmond. The gauge in this object is more of a modified bullet chart. If the sales are more than the target then good performance is shown as a shaded sector to the right of the vertical, while if the performance is below par it is shown as a shaded sector to the left of the vertical, as shown in the following figure:

There's more…

The Capventis Redmond Pie-Gauge can be downloaded from Qlik Branch at http://branch.qlik.com/projects/showthread.php?159-CapVentis-Redmond-Pie-Gauge-for-Qlik-Sense

See also

  • Creating Tree Maps
..................Content has been hidden....................

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