Beruflich Dokumente
Kultur Dokumente
Qlik® Sense
1.1
Copyright © 1993-2015 QlikTech International AB. All rights reserved.
Copyright © 1993-2015 QlikTech International AB. All rights reserved.
Qlik®, QlikTech®, Qlik® Sense, QlikView®, Sense™ and the Qlik logo are trademarks which have been
registered in multiple countries or otherwise used as trademarks by QlikTech International AB. Other
trademarks referenced herein are the trademarks of their respective owners.
Contents
It is assumed that you are familiar with the basics of Qlik Sense. You know how to make selections and how
to interpret the results of your selection.
l Data loading
l App design
l Visualization creation
l Reuse of visualizations, dimensions and measures
l Data storytelling
When you have completed the tutorial, you should have a fair understanding of the different steps involved in
the building of a Qlik Sense app. You will also be aware of some of the necessary considerations related to
the design of the app.
If you are using Qlik Sense, you may need help with some of the following:
One of the differences between Qlik Sense Desktop and Qlik Sense is that the quick data load
alternative is not available on Qlik Sense.
At help.qlik.com, you find the Qlik Sense online help and a number of downloadable guides.
These are all valuable sources of information and are highly recommended.
2 Building an app
Building an app involves some basic steps that you need to take to be able to design and use the app.
These are the basic steps. In more advanced apps, scripting often includes much more than just loading
data.
When you have installed Qlik Sense Desktop, you start it from the shortcut on your desktop, the left pane in
the Start menu, or the Qlik Sense folder, under All Programs.
When you start Qlik Sense Desktop, you arrive at the hub. You can close the greeting message.
The hub is the storage of your apps. If you have installed Qlik Sense Desktop recently, you may not have
many apps yet, and in that case, you are about to begin building your first app!
Do the following:
In the app overview you are presented with two options to load data, Quick data load and Data load
editor. You now need to decide which of these options to use.
l Sales.accdb or Sales.xlsx
l Item master.xlsx
l Region.txt
l Sales rep.csv
l Customers.xlsx
l MasterCalendar.txt
If you only want to load data as quickly as possible so that you can get started with the app building, you
should choose the Quick data load option. Click Quick data load.
If you want to learn how to load data from a Microsoft Access database and create an ODBC connection, you
should choose the Data load editor option. This option is a little more challenging, but also more rewarding,
especially if you need to know how to connect to database files. Click Data load editor and proceed to the
next chapter.
You can connect to and retrieve data from various data sources. In the script, you specify the fields and
tables to load. With the load script, you can use data from multiple data sources and compile the data into a
single Qlik Sense app.
You will load the data from the Access database file into Qlik Sense through an Open Database Connectivity
(ODBC) connector. To be able to use the ODBC connector, you must first install a driver to support your
database management system. Then you need to add and configure an ODBC data source, and finally
connect to the database.
Should you run into difficulties that prevent you from setting up the database connection, you
can jump to the next chapter and instead load data through the Quick data load. (The quick
data load option is not available on Qlik Sense.)
Do the following:
You must navigate to the file instead of searching for it. If you search for odbcad32, you
will be presented with the wrong file.
If you do not have the 64-bit version of Office 2010, you can install the 2010 Access database engine.
If you do not have any version of Office installed (neither 2007 nor 2010), you must install the 2007 Access
database engine.
Do the following:
5. Click Finish.
6. In the ODBC Microsoft Access Setup dialog type Tutorial ODBC as the Data Source Name.
7. Under Database, click Select.
9. When the file Sales.accdb is visible in the list below the Database Name text box, click
Sales.accdb.
Sales.accdb becomes the database name.
10. Click OK twice.
11. Verify that Tutorial ODBC has been added to the User Data Sources.
12. Click OK.
Do the following:
The data connection Tutorial ODBC is available under Data connections to the right.
Do the following:
1. Put the cursor two rows below the last SET statement.
3. Click ” and select Data model viewer to verify that your data is loaded.
4. In the data model viewer, click s to expand the table.
5. Click Save.
The table in the data model viewer should look like the following image. If your table is not displayed, or has
fewer fields, you can either go through the script and compare it with the script example, or remove the
existing load script and go through the procedure of building the script again.
When you make changes in the script manually, you must follow the scripting rules (syntax), otherwise you
will get a load error. In the script, you can see that all field names that have more than one word, have
quotation marks surrounding them. If you tried to load such a field without quotation marks, you would get a
load error. The same is true for the comma that ends each row. All rows with fields to be loaded must be
ended with a comma, except the row with the last field, which on the contrary must not be ended with a
comma.
It is easy to forget a comma or a quotation mark when you work with a script. Therefore, it is a good idea to
start to search for such errors when you get a load error. A syntax check is performed when you run the script.
If you get a syntax error, the editor highlights the location where the error is detected, but the cause of the
error can be one or more rows earlier.
Do the following:
6. In the Fields section, verify that the field names are displayed properly. If they are not, select
Embedded field names under Field names.
7. Click Load data.
LOAD statements for all the fields are inserted into a new section in the data load editor.
Under Data connections, you can see that a new connection has been created: Tutorial source. This
connection was created automatically when you loaded data through the Quick data load.
In the toolbar, click s to expand the tables. In the following screenshot the tables have been rearranged for
clarity, but the content in your tables should be the same.
The two tables have been connected. If you have two tables listing different things, for example, one table of
customers and one of invoices, and the two tables have a field (column) in common, for example, the
customer number, this usually means that there is a relation between the two tables. (In your data model, the
field in common is Item Number.)
If such a relationship exists, associations are made between the fields that are common to the tables; Qlik
Sense assumes that the two fields are one and the same thing, and the two fields are treated as one. Such a
field connecting two or more tables is called a key.
l For two fields to be associated, they need to have exactly the same name. The comparison is case
sensitive, so the fields Customer and customer are not the same and will not be associated.
l If a certain field has exactly the same value in several different input tables, Qlik Sense treats it as
one value and also assumes that the records (rows) containing the value should be associated. For
two field values to be associated, they need either of the following:
l exactly the same spelling (case sensitive)
l exactly the same numeric value
Consequently, Customer and customer are not the same and are not associated, but the numbers 123 and
00123 are the same and are associated.
The next chapter is only for those who load the sales data through the Excel file Sales.xlsx. You can proceed
to Loading more data (page 26).
You will load all the files in the folder, except MasterCalendar.txt, which is a special case. Begin with the file
Sales.xlsx.
Do the following:
2. Sales is already selected and the headings under Fields look correct. You only have to click Load
data.
A progress window is displayed and then a confirmation of a successful data load.
3. Click Close.
You are now in app overview. This is where you see all the sheets in your app. It is on the sheets that you
create your visualizations. But before you begin to design the sheets, you will load more data.
Do the following:
4. The table Item master is already selected, but in the Fields section, you can see that the field
headings are not displayed properly. In the Field names list, select Embedded field names to
correct this.
5. Click Load data.
The data is loaded and a confirmation is displayed.
6. Click Close.
Do the following:
For the sake of clarity, the tables have been rearranged, but you should have the same content in your tables.
The two tables have been connected. If you have two tables listing different things, for example, one table of
customers and one of invoices, and the two tables have a field (column) in common, for example, the
customer number, this usually means that there is a relation between the two tables. (In your data model, the
field in common is Item Number.)
If such a relationship exists, associations are made between the fields that are common to the tables; Qlik
Sense assumes that the two fields are one and the same thing, and the two fields are treated as one. Such a
field connecting two or more tables is called a key.
l For two fields to be associated, they need to have exactly the same name. The comparison is case
sensitive, so the fields Customer and customer are not the same and will not be associated.
l If a certain field has exactly the same value in several different input tables, Qlik Sense treats it as
one value and also assumes that the records (rows) containing the value should be associated. For
two field values to be associated, they need either of the following:
Consequently, Customer and customer are not the same and are not associated, but the numbers 123 and
00123 are the same and are associated.
A couple of more files to load before you can start working with the visualizations.
Do the following:
4. As you can see in the preview, the field names need to be recognized. In the Field names list, select
Embedded field names.
5. Click Load data.
The new addition to the data model viewer should look as follows:
7. The Region table is not connected to any other table, because there are no fields to associate to. The
table Region does not have any fields in common with the other tables. A field does not necessarily
have to connect to other tables, it can still be useful. It may also be that one of the source files that
remains to be loaded can contain a field that connects to the Region table.
Furthermore, you can in many cases also create a connection in the load script to achieve a
connection that you would like to have.
Do the following:
The table Sales rep is not associated to any other table. Whereas more peripheral tables may exist on their
own, you would expect an important table as Sales rep to be associated to Sales so that it is possible to see
the relation between sales and a certain sales representative. Since the tables are not associated, they do
not have any field in common, but that does not necessarily mean that there is no potential association. It
may be that the same type of field exists in both tables, although with different names. If you compare the
fields in Sales rep with the fields in Sales, you can see that there are no fields that seem to correspond to the
manager fields, nor is there anything related to Path. Sales Rep Name 1/2/3 are pretty close to Sales Rep
Number, but Sales Rep ID may be an even better match. It is very important that the associations between
the tables are correct, otherwise the app will show incorrect values.
If you open the Excel source files Sales.xlsx and Sales rep.csv and compare the fields Sales Rep Number
and Sales Rep ID, you will see that both contain three-digit values between 103 and 185. It is reasonable to
assume that the fields contain the same type of data - identification of the sales representatives. If this
situation occurs when working with real data, it is strongly recommended that you get a confirmation that the
two fields really correspond to each other. Let us say that it has been confirmed that the fields Sales Rep
Number and Sales Rep ID correspond. Then you need to associate the two fields. The way to do it is to
rename one of the fields so that it matches the other one. You could of course do this in the Excel source file,
but that may have undesired consequences, because that file could be used in other contexts where it is
important that the field name remains unchanged. A better solution is to make the change in the script that
will only affect this app.
Do the following:
You must not use any comma at the end of the row, because it is the last row before the FROM
statement.
In the toolbar, click Load data. When the data has been loaded, close the confirmation window. Click ”
and select Data model viewer. The data model now looks as follows.
Now you have an association between the tables Sales rep and Sales! The field Sales Rep Number in Sales
rep was previously Sales Rep ID, but by changing the field name, you managed to create an association
between the two fields in the tables.
Although it is more common to want to create an association between two fields with different
names, you may also run into the opposite problem: two fields with the same name, but with
content that should not be associated. If you have the field Date both in a table called Invoices
and in another table called Orders, you do not want to have an association between the fields
since they refer to different things. The invoice date is not the same as the order date. A good
solution would be to rename both Date fields to avoid any confusion about which Date it is. The
fields could be renamed InvoiceDate and OrderDate.
The data model viewer should now have the following content.
The data from Customers has been added, and now the table Region is no longer isolated. The table
Region and the table for customer data have a field in common: Region Code,which thereby becomes a key.
Now, all tables are associated, and not only that, they have single associations, which is good. When you
load data, you may sometimes get data models with undesirable associations. Synthetic keys and circular
references are two different results of (normally) undesirable associations. It is beyond the scope of this
tutorial to cover these topics, but it is good to know that these exist and that they need to be investigated to
ensure that no ambiguity is introduced through synthetic keys or circular references. Refer to the online help
for more information.
Looking again at the data model, there is still a possible improvement, a table title. The customer data of
table does not have a proper title. It is called Sheet1, which is not very informative. The remedy is to edit the
script so that the title is displayed.
Do the following:
With a larger script you can use the search function (F) to find what you are looking
for. Search for a field that is unique for that table, or the source file name.
3. Put the cursor to the left of the LOAD statement in line 1 and press Enter to create a new empty row.
4. On the empty row, enter the following string (including the colon):
Customer:
5. Click Load data.
6. Close the confirmation window.
The customer table now has the correct title. You can remain in the data load editor for the final steps before
you start working with the visualizations.
Do the following:
SET ThousandSep=',';
SET DecimalSep='.';
SET MoneyThousandSep=',';
SET MoneyDecimalSep='.';
SET MoneyFormat='$#,##0.00;($#,##0.00)';
SET TimeFormat='h:mm:ss TT';
SET DateFormat='M/D/YYYY';
SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
You should now have 10 SET statements at the beginning of the script.
6. Use the handle (o) to drag the section Master calendar to the bottom of the list.
7. Click Load data.
8. Close the confirmation window.
You have finished loading data and can start building your app.
7 App design
You have loaded the data. Now it is time to create the user interface. User interface design involves using the
right objects in the right way, and making the sheets well structured and user-friendly. This app will be fairly
simple, but you will learn some basic design principles that are good to know. If you want to build an app of
your own, and want some inspiration, you should visit the Qlik web site. There you find a large number of
apps serving a wide variety of different purposes. If you are looking for something that could function as
template when you want to design your own app, chances are pretty good that you can find something useful.
Click Create new sheet and name the sheet Dashboard. Do the same for the sheets Product Details and
Customer Details. You now have three sheets that all belong to the same app, Tutorial.
The following screen shots show what the app will look like when it is finished.
As you can see there are similarities between the sheets. Filter panes with time, place, and managers are to
the left in all the sheets. It is good to strive towards consistency when you design an app. Visualizations that
are present in several sheets should have the same position in all sheets so that the user knows where to find
them. There should be a logic in the design that supports the users in achieving their goal, that is, making
data discovery. So, placement is one aspect of the design, another is the choice of visualization. Each
visualization has its own advantages, and to be able to build an efficient and well-functioning app, you need
to be aware of those advantages. To some extent the visualizations are self-explanatory. Graphical elements
are great for giving overviews and showing trends, whereas tables are economical in that they can present
large amounts of data using a limited space.You get exact figures, but lose the quick and easily digestible
information that is conveyed in graphical elements.
The assets panel and the properties panel have a show/hide functionality in the bottom left and
right corners. Click h to switch between showing and hiding the panel.
The screenshot for the sheet Dashboard shows the sheet when editing. To the left there are two filter panes,
the time filter pane without a title and Region. You will begin with these.
Drag the charts to the center of the area where you want to place them.
3. At the top of the assets panel to the left, click - to open Fields.
4. Scroll down in the list to Quarter and drag the field to the center of the filter pane.
5. Drag the field Month to the filter pane.
6. Add the field Week in the same way.
7. Use the handles to resize the filter pane according to the screenshot.
8. Right-click the filter pane and select Add to master items.
9. Type the name Period and click Add.
You have created a filter pane and saved it as a master item which facilitates reuse.
Do the following:
1. At the top of the assets panel, click 5 to open Charts and drag a filter pane to the sheet.
2. Click Add dimension and scroll down and select the field Region.
3. Use the handles to resize the filter pane according to the screenshot.
4. Right-click the filter pane and select Add to master items.
5. Type the name Region and click Add.
The two filter panes are complete. In the toolbar above the sheet, click Save.
Do the following:
1. At the top of the assets panel, click 5 to open Charts and drag a pie chart to the sheet.
2. Click Add dimension and scroll to the bottom of the list to add the field Region.
6. Click Create.
The measure is added as a master item.
7. Drag the new measure Sales to the center of the pie chart.
8. Use the handles to resize the pie chart according to the screenshot.
9. In the properties panel to the right, click Appearance > Presentation and select Donut.
10. Still in the properties panel, click Colors and legend.
11. Click the Colors button and select By measure in the list.
12. At the top of the visualization, add the title Sales per Region.
The donut pie chart is complete. The colors in the pie chart are by measure, which means the higher the
value, the darker the color. You have many options when it comes to coloring the values. Just remember that
the colors should serve a purpose and not be used just to make the visualization more colorful.
Do the following:
1. In Charts in the assets panel, drag a bar chart to the sheet. Place it under the pie chart.
2. Click Add dimension and scroll down and select the field Customer.
3. Click Add measure and under Measures, select Sales.
4. Right-click the bar chart and select Flip in the shortcut menu.
The bars are displayed horizontally.
5. In the properties panel to the right, click Dimensions > Customer to open the dimension.
6. In the list Limitation, select Fixed number.
7. The default setting is to display the top 10. Change the number to 5.
8. Clear the selection Show others.
9. In the properties panel, click Appearance > Y-axis:Customer.
10. Under Labels and title, select Labels only.
11. Click X-axis:Sales.
12. Under Labels and title, select Labels only.
13. Resize the bar chart according to the screenshot.
14. At the top of the visualization, add the title Top 5 Customers.
The bar chart is complete. You have created a bar chart showing the top five customers. When you make
selections in other visualizations, these customers will change, accordingly. If you had not cleared the
selection Show others, the fifth bar would have been gray, summarizing all the sales values where the
company name is missing. This value can be useful to get an understanding of how much of the sales that
cannot be referred to a specific company.
Do the following:
1. Click Charts and drag a combo chart to the sheet. Place it under the bar chart.
2. Click Add dimension and select the field MonthYear.
3. Click Add measure and under Measures, select Sales.
4. At the top of the assets panel to the left, click é to open Master items.
5. Under Measures, click Create new.
6. Copy and paste the following string into the Expression box:
(Sum(Sales) - Sum(Cost)) / Sum(Sales)
7. Type the name Margin and click Create.
The new measure is added to the list of master item measures.
8. Drag the measure Margin to the combo chart.
9. Select to add Margin as a line.
10. Under Number formatting, select Number, and in the Formatting list that is displayed, select 12%
11. Resize the combo chart according to the screenshot.
12. At the top of the visualization, add the title Sales Trend.
The combo chart is complete. The two measures Sales and Margin have one axis each, which enables the
combination of two totally different scales. The primary axis to the left is used for Sales and the secondary
axis to the right is used for Margin in percent.
Do the following:
1. Click Charts and drag a text & image chart to the sheet. Place it to the right of the pie chart.
2. In the properties panel to the right, click Add measure.
3. Copy and paste the following string into the text box where the cursor currently is:
='$'&Round(Sum(Margin)/1000000, 0.1) & 'M'
4. Press Enter.
5. Under Label, change the title to Total Margin.
6. Once more, in the properties panel, click Add measure.
7. Copy and paste the following string into the text box where the cursor currently is:
='$'&Round(Sum(Sales)/1000000, 0.1) & 'M'
8. Press Enter.
9. Under Label, change the title to Total Sales.
10. In the text & image chart, position the cursor to the left of the measures and type Total Margin:.
11. Use the right arrow key to jump to the next measure and type Total Sales:.
12. Press Ctrl+A and change the font size to XL.
13. If you need to separate the two values so that they are on one row each, position the cursor after Total
Margin: and press Enter.
14. Resize the text & image chart according to the screenshot.
The text and image chart is complete. You have added two expressions that include both text and measures.
The function Round () is used to reduce the number of decimals. In the toolbar above the sheet, click Save.
Do the following:
The gauge is complete and displays a large profit margin. The different gauge colors support the
interpretation of the value. Red is worrying, whereas green is good.
Do the following:
1. At the top of the assets panel, click 5 to open Charts and drag a line chart to the sheet.
2. Click Add dimension and scroll down to select the field Quarter.
3. Click Add measure and select Sales from the list Measures.
4. In the properties panel to the right, under Dimensions, click Add dimension.
5. Scroll down to select Year.
6. In the properties panel, under Appearance > Presentation, select Show data points.
7. Under Colors and legend, click the Show legend button to set it to Auto.
8. At the top of the visualization, add the title Quarterly Trend.
You have completed the first sheet. In the top right corner, click ë to move to the sheet Product Details.
Do the following:
The bar chart is complete. By default, the measures are grouped when you add a second measure to a bar
chart.
Do the following:
The treemap and sheet are complete. The next sheet is the final one. In the top right corner, click ë to
move to the sheet Customer Details.
By now you have so much experience from creating dimensions, measures, and visualizations that you do
not need detailed procedures anymore. The only exception will be when you make changes in the properties
panel.
In the properties panel, at the bottom of Appearance, use the Range setting for the Y-axis and X-axis to
exclude the negative part of the axes.
You probably noticed that two measures were added to the scatter plot. The scatter plot is used to visualize
the relationship between two or three measures. In this case the measures compared are Sales and
Quantity. Each bubble represents a Customer dimension value.
For the measure # of invoices, use the following expression: Count (Distinct [Invoice Number])
For the measure Average Sales per Invoice, use the following expression:
The qualifier Distinct is used in two of the expressions. By using Distinct, you ensure that an
invoice number is only counted once, even if it occurs several times in the data source.
Distinct sorts out unique numbers. Note that Distinct must be followed by a space before the
field name.
8. Click Average Sales per Invoice and set Number formatting to Money.
9. Close the setting.
Congratulation on your achievement of building a Qlik Sense app! Before you start making data analysis, you
can complement the app with data storytelling.
11 Data storytelling
With data storytelling you can create a presentation based on the data in your app. You can take snapshots
of selected visualizations and use them in your narrative together with text, shapes, and effects. You create
slides and design the story with your particular audience in mind. In your narrative you focus on key elements
and create a convincing story where you can get your message through.
An additional, useful feature of data storytelling is that you can easily, during a presentation, switch between
a snapshot in the presentation and its context in the app. In the app context, you can make new selections
and continue the analysis from where you left off in the presentation. After the analysis, you can resume the
presentation.
In the presentation you will focus on the three largest regions and analyze the sales trends.
Do the following:
1. Right-click the visualization Sales per Region and select Take snapshot.
2. In Region, select Nordic.
3. Right-click the visualization Top 5 Customers and select Take snapshot.
4. Right-click the visualization Quarterly Sales Trend and select Take snapshot.
5. In Region, deselect Nordic and select USA.
6. Take snapshots from the same visualizations as for Nordic.
7. In Region, deselect USA and select Japan.
8. Take snapshots from the same visualizations as for Nordic.
You have taken all the snapshots you need and can continue to start creating your data storytelling slides.
Slide 1
Do the following:
11. Copy the pie chart and paste it next to the first one. You can either use Ctrl+C and Ctrl+V or ¶ and
∂ in the toolbar at the bottom.
12. In the new pie chart, click Ñ and select USA in the list Select data point.
13. In the same manner as for the second pie chart, create a third pie chart and highlight Japan.
Slide 2-4
The slides 2-4 show the top five customers and the quarterly sales trend for the three regions.The snapshots
are stored in the library in the order they were taken, with the latest one at the top. If you have followed the
procedures when taking these snapshots, the two at the top should be Japan, the two ones below, USA, and
the remaining two, Nordic. Do not worry about using the wrong snapshot, the next section will explain how to
verify which snapshot is which.
Do the following:
Now, follow the steps above to create sheets with the same content for USA and then for Japan. The size
and alignment of the title and snapshots should be the same as in the sheet Nordic.
You can right-click the sheet Nordic and select Duplicate to create a new sheet that can be
used as a template for the remaining sheets. Change the title and replace the snapshots.
When analyzing these slides it is important to know that the figures for 2014 are half-year figures.
Extrapolating the figures for the full year would then give different forecasts for the different regions.
The story is complete. Click U in the upper left corner to play your presentation. You can navigate with the
left and right arrow keys, or by moving the mouse towards the left and right edges of the slides to use the
arrows.
Close the story and make edits, if needed. Below the slide you have tools for cutting, copying, and pasting
that can be useful when you edit your presentation. And, of course, you can use the panel to the right.
The go to source option is also useful for the special purpose of verifying that the right bar charts and line
charts are used. When you select Go to source you will see which region that is selected for that specific
snapshot.
Additional options
There are many options that have not been used in this story. Experiment on your own. Try and add effects to
the bar chart. Add a new slide (Sheet) and embed a complete app sheet where you can make selections
when you are in play mode. Add URLs or bookmarks to text strings. There is plenty more to discover.