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
Qlik Sense Cookbook

You're reading from   Qlik Sense Cookbook Over 80 recipes on data analytics to solve business intelligence challenges

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781788997058
Length 334 pages
Edition 2nd Edition
Arrow right icon
Authors (3):
Arrow left icon
Philip Hand Philip Hand
Author Profile Icon Philip Hand
Philip Hand
Neeraj Kharpate Neeraj Kharpate
Author Profile Icon Neeraj Kharpate
Neeraj Kharpate
Pablo Labbe Pablo Labbe
Author Profile Icon Pablo Labbe
Pablo Labbe
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting Started with the Data FREE CHAPTER 2. Visualizations 3. Scripting 4. Managing Apps and the User Interface 5. Useful Functions 6. Set Analysis 7. Using Extensions in Qlik Sense 8. Advanced Aggregation with AGGR 9. Tips and Tricks 10. Other Books You May Enjoy

Using visual data preparation on the data manager model viewer

If you are a QlikView developer beginning to use Qlik Sense, you are very familiar with the load-script editor and the powerful commands available there, but most business users are not familiar with coding, so Qlik Sense provides Data manager, a visual data preparation tool tailored for non-technical users. It's a great tool even for experienced QlikView developers.

With data manager, you can create table associations using drag and drop, concatenate tables, and synchronize scripted tables within the data manager.

You can also create table fields that calculate values, create calendar fields, use the data profiling cards to create numeric buckets, and handle string fields with the Replace, Set nulls, Order, and Split functions.

The data manager can detect geographical data in your table if it have columns with country and city names. It can detect geopoint data (latitude, longitude) for a single location, such as a city or a customer site. It can also detect area data (polygons) to represent regions or countries when loading this information from flat files like TXT or XLS.

Our recipe focuses on some of these functionalities, such as visual data association, concatenation, calculated field, and string replace.

Getting ready

How to do it...

  1. Create a new Qlik Sense application and name it Qlik Sense Cookbook Visual Data Peparation.
  2. When starting a new application, Qlik Sense always asks to choose between the Data manager and the load script editor. Choose Add data from files and other sources:
  1. Click on My computer in the file location section on the left, and navigate to the folder with the Sales Data.xlsxfile and click in the file:
  1. After selecting the file, we can see a list with all sheets in the Excel file. Select all sheets, as in the following screenshot:

  1. Before proceeding to the next step, check whether the data profiling is active. Click on the button with the three dots to check:
  1. Click on Add data:

We also have a fourth table with data from 2017, so we need to import that too.

  1. Click on the Plus circle in the top-left corner to insert another table:
    • Open My computer and select Sales Data 2017.xlsx. It only has one sheet with data related to 2017.
    • In the preview windows, select the Orders sheet and click on Add Data.
    • Once the connection is created, we can start to model and prepare our data with the associations and table editors:

How it works...

When we added the data, Qlik sense created a bubble for each table. After inserting a new table with data from 2017, it automatically created a table concatenation between the Orders table from Sales Data.xlsx and Sales Data 2017.xlsx. Note the multi-circle at the top of the table name; it's an indicator for a table created by file concatenation:

To associate the tables and create connections between them, follow these steps:

  1. Click on the Customers table.
  2. Check whether any other table has a green bar. The green bar shows which table has the stronger match for the association. The more it is filled, the stronger a candidate it is for the association:
  1. Drag the Customer table over the Orders table to create the association between them.
  2. Click on the association to review which field was used:
  1. The field is Customer ID.
  2. Repeat steps 1 through 5 for the Products and Salesman tables.
  3. At the end, the tables' connections will look like the following screenshot:

Now we must review the data in the Sales table. Perform the following steps:

  1. Click on the Tables button at the top-right of the screen to open the table editor. You will see the following screen:
  1. Move the mouse pointer over the Order box and click on the pencil to edit the table:
  1. In the table editor, click on the Ship Mode column header to select the field. A profiler window at the bottom shows the distribution of values for each category of data, and the data profiling card on the left. It looks like the following screenshot:
  1. There are some data mismatches in the column that we need to fix using the replace card. Select Standard Class and Std Class (note that the replacement value is the first value selected).
  2. Click on Replace. The card will be updated and show only the replaced value merging Std Class with Standard Class.
  3. Repeat the steps to merge First Class and 1st Class as First Class.
  1. Repeat the steps to merge Second Class, 2nd Class, and Second Clas as Second Class.
  2. We have replaced several values to keep with only four distinct values, as in the following screenshot:

Add a calculated field:

  1. In the same table, click on Add field and select Calculated field. It will show the calculated field panel editor on the right of the screen.
  2. In the Name field, write Discount Value.
  3. In the Expression box, write Sales * Discount. The panel provides a preview box showing the result of the expression for each line of the table.
  1. Click on Create. Now you see a new column at the end of the table with the calculated field. An example is shown in the following screenshot:
  1. Click on Load data to reload data in the application.

When we create a table association, Qlik Sense profiles your data help you create associations between tables, irrespective of the name of the column on each table. When adding several tables with the same name and column, the data manager creates an automatic concatenation. In all fields of the table, it's possible to transform the data: if the data is a numeric value, you can create buckets. If the column contains string data, you can perform Replace, Set Nulls, Order, or Split operations. You can create calculated columns as well, but the calculation can only reference columns in the same table.

When doing all this data preparation, the data doesn't load in the memory; you need to click on Load data (the green button) to reload the app with all changes into memory and to start creating visualizations with new tables and fields.

There's more...

If you are aware of the data you are loading, you can disable data profiling to speed up the load processing in the data manager, especially if you have memory constraints and huge datasets with millions of rows.

When disabling data profiling, Qlik Sense can't recognize location data using city and country names, so you will not be able to visualize data with maps in your app.

The editor also can handle tables with different columns, and you can force the concatenation during column pairing. To do this, click on More options (the button with three dots) at the bottom of the screen in the associations or table editor, and select Concatenate Tables.

You have been reading a chapter from
Qlik Sense Cookbook - Second Edition
Published in: Aug 2018
Publisher: Packt
ISBN-13: 9781788997058
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