Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
QlikView for Developers Cookbook

You're reading from   QlikView for Developers Cookbook Take your QlikView training to the next level with this brilliant book that's packed with recipes which progress from intermediate to advanced. The step-by step-approach makes learning easy and enjoyable.

Arrow left icon
Product type Paperback
Published in Jun 2013
Publisher Packt
ISBN-13 9781782179733
Length 290 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Stephen Redmond Stephen Redmond
Author Profile Icon Stephen Redmond
Stephen Redmond
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

QlikView for Developers Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Charts 2. Layout FREE CHAPTER 3. Set Analysis 4. Advanced Aggregations 5. Advanced Coding 6. Data Modeling 7. Extensions 8. Useful Functions 9. Script 10. Improving Performance 11. Security Index

Creating a secondary dimension in a bar chart


Within QlikView, there is the possibility of displaying a secondary X-axis in a bar chart. This can be useful for displaying some hierarchical data, for example, year and month. In fact, it only really works where there is a strict hierarchy such as this. Each of the secondary values would exist in each of the primary values (as each month occurs in each year).

Getting ready

Load the following script:

CrossTable(Year, Sales)
LOAD * INLINE [
    Month, 2011, 2012, 2013
    1, 123, 233, 376
    2, 423, 355, 333
    3, 212, 333, 234
    4, 344, 423
    5, 333, 407
    6, 544, 509
    7, 634, 587
    8, 322, 225
    9, 452, 523
    10, 478, 406
    11, 679, 765
    12, 521, 499
];

How to do itā€¦

Follow these steps to create a bar chart with a secondary dimension:

  1. Create a new bar chart with Year and Month as dimensions and the expression:

    Sum(Sales)

    Note

    Note that this chart shows the monthly trend.

  2. Edit the chart and add a second expression with just a value of 0:

  3. A new legend will appear.

  4. Open the properties and go to the Presentation tab. Deselect the Show Legend option:

    Note that all subvalues (months) are displayed under all the primary values (years).

  5. Edit the properties of the chart and go to the Axes tab. Set the Secondary Dimension Labels to the / option as shown in the following screenshot:

    Note that the labels for the secondary dimension are now at an angle:

How it worksā€¦

QlikView will automatically add the secondary dimension to a bar chart when:

  • There are more than two dimensions

  • There are two dimensions and there are two or more bar expressions

If there are two expressions, the bars will automatically stack. By setting an expression with a value of 0, the second bars will not appear. However, we do need to remove the legend.

There's moreā€¦

This can be useful in a number of situations. However, as previously noted, the two dimensions must be in a strict hierarchy. If there are values that don't exist under all the primary dimensions, they will be represented under all of them anyway and that may not achieve the results that you were hoping for.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image