Book Image

QlikView for Developers Cookbook

By : Stephen Redmond
Book Image

QlikView for Developers Cookbook

By: Stephen Redmond

Overview of this book

QlikView has been around since 1993, but has only really taken off in recent years as a leader in the in-memory BI space and, more recently, in the data discovery area. QlikView features the ability to consolidate relevant data from multiple sources into a single application, as well as an associative data model to allow you to explore the data to a way your brain works, state-of-the-art visualizations, dashboard, analysis and reports, and mobile data access. QlikView for Developers Cookbook builds on your initial training and experiences with QlikView to help you become a better developer. This book features plenty of hands-on examples of many challenging functions. Assuming a basic understanding of QlikView development, this book provides a range of step-by-step exercises to teach you different subjects to help build your QlikView developer expertise. From advanced charting and layout to set analysis; from advanced aggregations through to scripting, performance, and security, this book will cover all the areas that you need to know about. The recipes in this book will give you a lot of the information that you need to become an excellent QlikView developer.
Table of Contents (19 chapters)
QlikView for Developers Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using redundant encoding with a scatter chart


It is very typical to display values for categorical dimensions using a bar chart. This is a very powerful and simple way to understand a chart. The length of the bars models the values in a very intuitive way.

Sometimes, however, it can be valuable to add an additional level of encoding to gain additional insight.

In this example, we are going to add space as an additional encoding. We can do this using a scatter chart.

Getting ready

Load the following script:

LOAD * INLINE [
    Country, Sales
    USA, 100000
    UK, 60000
    Germany, 50000
    France, 45000
    Canada, 30000
    Mexico, 20000
    Japan, 15000
];

How to do it…

Use the following steps to create a scatter chart demonstrating redundant encoding:

  1. Create a new scatter chart.

  2. Add a calculated dimension with the following expression:

    =ValueList(1,2)
  3. Deselect the Label and Show Legend options for this dimension.

  4. Add Country as the second dimension.

  5. On the Expressions tab, add two expressions:

    Sum(Sales)
    If(ValueList(1,2)=1, 0, Sum(Sales))
  6. Both expressions can be labeled as Sales $:

  7. On the Sort tab, select the Country dimension and turn on the Expression option. Enter the expression:

    Sum(Sales)
  8. The direction should be Descending.

  9. Go onto the Axes tab and select Hide Axis under the X Axis options.

  10. On the Numbers tab, format both expressions as Integer.

  11. Click on Finish.

  12. The chart displays with apparent bars and spacing between them. We can quickly see how much bigger the gap is between the USA and other countries. We can also identify clusters of similarly performing countries.

How it works…

If a scatter chart has two dimensions, it will change from displaying bubbles to displaying lines between the values in the first dimension.

The first expression here positions where the bars will exist. It is our space encoding.

The second expression has a test to see if it is ValueList = 1, which sets a value of 0, or ValueList = 2, which sets the Sales $ value.

There's more…

This is an example of the use of pseudo dimensions using ValueList. This can be a very powerful function in dimensions.

The more frequent first dimension of a multidimensional scatter chart would be a date dimension, such as a year. This gives you the option to show lines going from year to year. Additional options in Presentation allow such items as arrows.