Home Data QlikView for Developers Cookbook

QlikView for Developers Cookbook

By Stephen Redmond
books-svg-icon Book
Subscription FREE
eBook + Subscription €14.99
eBook €28.99
Print + eBook €37.99
READ FOR FREE Free Trial for 7 days. €14.99 p/m after trial. Cancel Anytime! BUY NOW BUY NOW BUY NOW
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
READ FOR FREE Free Trial for 7 days. €14.99 p/m after trial. Cancel Anytime! BUY NOW BUY NOW BUY NOW
Subscription FREE
eBook + Subscription €14.99
eBook €28.99
Print + eBook €37.99
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
  1. Free Chapter
    Charts
About 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.
Publication date:
June 2013
Publisher
Packt
Pages
290
ISBN
9781782179733

 

Chapter 1. Charts

In this chapter, we will cover:

  • Creating custom pop-up labels in a bar chart

  • Creating a box plot chart for a simple data set

  • Using the wizard to create a box plot chart

  • Creating a "Stephen Few" bullet chart

  • Creating a modified bullet chart in a straight table

  • Creating a bar chart in a straight table

  • Creating a Redmond Aged Debt Profile chart

  • Creating a waterfall chart

  • Replacing the legend in a line chart with labels on each line

  • Creating a secondary dimension in a bar chart

  • Creating a line chart with variable width lines

  • Brushing parallel coordinates

  • Using redundant encoding with a scatter chart

  • Staggering labels in a pie chart

  • Creating dynamic ad hoc analysis in QlikView

 

Introduction


Charts are the most important area of QlikView because they are the main method of information delivery, and QlikView is all about information delivery.

There are a few terms that I want to just define before we get cracking, just to make sure you know what I am talking about.

The basis of every chart is some kind of calculation—you add up some numbers or you count something. In QlikView, these calculations are called expressions. Every chart should have at least one expression. In fact, some charts require more than one expression.

Most of the time, the expression value that is calculated is not presented in isolation. The calculation is normally made for each of the values in a category. This category is generally the values within a field of data, for example, country or month, in the QlikView data model, but it could be a more complex calculated value. Either way, in QlikView charts, this category is called a dimension. Some charts, such as a gauge, would normally never have any dimension. Other charts, such as a pivot table, will often have more than one dimension.

Many simple charts will have just one dimension and one expression. For historical and mathematical reasons, the dimension is sometimes called the X-Axis and the expression is sometimes called the Y-Axis and you may see these terms used in QlikView.

 

Creating custom pop-up labels on a bar chart


The default pop up for a QlikView bar chart is useful but is not always exactly what you want.

The format is as follows:

Dimension name = value

Expression label = value

Now, we may not like this pop up and wish to display the values differently or add different formats. We may even want to include additional information.

In the preceding example, the pop up shows the value of Sales $ for Germany. If I want to see the value of the Costs $, I need to hover over the Costs $ bar. And what if I wanted to see Margin $ or Margin %?

Getting ready

Create a new QlikView document and save it to a folder. Edit the script (Ctrl + E or the File menu – Edit Script).

Enter the following script:

LOAD * INLINE [
    Country, Sales, Costs
    USA, 1000, 800
    UK, 800, 700
    Germany, 900, 1000
    Japan, 600, 400
];

Tip

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

How to do it…

Use the following steps to create a new bar chart and add custom labels:

  1. Create a new bar chart with the following characteristics:

    Dimension

    Country

    Expression 1

    Sum(Sales)

    Expression 2

    Sum(Costs)

  2. Click on Finish.

  3. You should see a bar chart with two bars for each country. Confirm that the pop up on each bar displays as expected.

  4. Open the chart properties.

  5. Click on the Presentation tab and deselect the Pop-up Labels checkbox. Click on OK and note that there are no longer any pop-up labels appearing.

  6. Edit the properties again and click on the Expressions tab. Click on the Add… button and enter the following expression:

    ='Sales : ' & Num(Sum(Sales), '#,##0')
  7. Click on OK.

  8. Deselect the Bar option for this expression and turn on the Text as Pop-up option. Click on OK.

    Note

    Note that the new custom pop up is now active and displays the sales value whether you hover over the Sales $ or Costs $ bar.

  9. Edit the properties again and edit the pop-up expression as follows:

    = Country & chr(10)  
    & 'Sales : ' & Num(Sum(Sales), '$(MoneyFormat)') & chr(10)
    & 'Costs : ' & Num(Sum(Costs), '$(MoneyFormat)') & chr(10)
    & 'Margin : ' & Num(Sum(Sales)-Sum(Costs), '$(MoneyFormat)') 
    & chr(10) & 'Margin % : ' 
    & Num(1-(Sum(Costs)/Sum(Sales)), '0.0%')
  10. Click on OK on the expression editor and then click on OK to close the properties.

  11. Check that the custom pop up is displayed.

How it works…

By turning off the Bar option for the expression, QlikView will not try and evaluate the expression as a value and will not try to render a bar for it. By turning on the Text as Pop-up option, we tell QlikView to calculate the text of the expression and display it in the pop up.

We also had to turn off the default pop-up option in the Presentation tab or else it would display both (which might be what you want, have a play with it).

The chr function is useful to know about adding, so called, non-printable characters into your output. chr(10) is a line feed that moves the text onto the next line.

Note

Note that we have used a variable here for the format string. MoneyFormat is one of the standard QlikView variables that are generated in the script when you first open the script editor.

There's more…

The cool thing about this is that you can use it everywhere! It works in a lot of different charts and is a great way of giving users additional information about the data that they are looking at.

                           
About the Author
  • Stephen Redmond

    Stephen Redmond is the CTO and Qlik Luminary at CapricornVentis - a QlikView Elite Partner. He is the author of several books, including QlikView for Developers Cookbook and QlikView Server and Publisher, both published by Packt Publishing. He is also the author of the popular DevLogixseries for SalesLogix developers. In 2006, after many years of working with CRM systems, reporting and analysis solutions, and data integration, Stephen started working with QlikView. Since then, CapricornVentis has become QlikView's top partner in the UK and Ireland territories, and with Stephen as the head of the team, they have implemented QlikView in a wide variety of enterprise and large-business customers across a wide range of sectors, from public sector to financial services to large retailers. In 2014, Stephen was awarded the Luminary status by Qlik in recognition of his product advocacy. He regularly contributes to online forums, including the Qlik Community.

    Browse publications by this author
Latest Reviews (8 reviews total)
Great details and easy to follow/use.
Veel praktische voorbeelden. Geeft niet altijd inzicht in de gevolgde stappen. Handig in gebruik
Good concepts explained very clearly
QlikView for Developers Cookbook
Unlock this book and the full library FREE for 7 days
Start now