You are on page 1of 7

Associating Tables and Transforming Data – Syntax

Stacked preceding load blocks


Table association by field alias syntax
▪ Create or break table associations by aliasing fields in
the table LOAD block TableName:
▪ Syntax is:
LOAD
o SourceFieldName AS TargetFieldName
G * 100 AS X;

Direction of row data


Data transformations LOAD
E - F AS G;
▪ Transformation of data can occur:
o On a source database server, prior to loading into Qlik Sense
o On the Qlik Sense side, as data is received (preferred method) LOAD
▪ Use powerful Qlik Sense functions in the table preceding LOAD block A + B AS E,
C * D AS F;

Preceding load blocks


SQL SELECT
▪ Can access any of the fields passed up from the block below A,
▪ Handle data in a row-by-row stream (except optimized QVD files) B,
▪ Enable expression caliculatons to be performed on the Qlik Sense side C,
▪ Are best practice for loading data into Qlik Sense models D
FROM database;

© 2017 QlikTech International AB. All rights reserved. Qlik®, Qlik Sense®, QlikView®, QlikTech®, Qlik Cloud®, Qlik DataMarket®, Qlik Analytics Platform®, Qlik NPrinting®, Qlik Connectors®, Qlik GeoAnalytics® and the
QlikTech logos are trademarks of QlikTech International AB which have been registered in multiple countries. Other marks and logos mentioned herein are trademarks or registered trademarks of their respective owners.
Learning module: Create Master Library Items

Exercise - INSTRUCTIONS
Using the Example Download instructions on the right, open the My Business Example Download
Analysis.qvf file. This partially configured app already has data loaded and will be
The example file supporting this
used to provide an opportunity for you to practice creating a few master items.
exercise is available in the
‘Example files’ section of this
learning module. Access the zip
Master Items for Ease of Use archive, which contains all of the
• Open Sheet 1 and create the following master items. This will make these example files for this module, and
measures and dimensions easier to access when we are ready to create extract its contents.
visualizations. The My Business Analysis.qvf
file can be opened in one of two
- Use the AccountGroupDesc field to create a master dimension
ways:
(Single field). Name the master dimension: “Account Type”.

- Add AccountDesc as another master dimension (Single field). Option 1:


Name the master dimension: “Account Description”.
Move the file to your Qlik Sense
- Use the AccountDesc field to create a master measure. Edit the Desktop hub directory at ...
expression to read: Count(DISTINCT AccountDesc) C:\Users\<user>\Documents\Qlik
\Sense\Apps
Name the master dimension: “Number of Accounts”.
... which will cause it to become a
- Use the ExpenseActual field to create a master measure. Edit the permanent part of your hub.
expression to use a Sum aggregation: Sum(ExpenseActual).
Name the master measure: “Actual Expense Total”.

- Use the ExpenseBudget field to create a master measure. Edit the


expression to use a Sum aggregation: Sum(ExpenseBudget).
Name the master measure: “Expense Budget Total”. Option 2:
Drag & drop the file onto your hub
(note: this approach opens, but
• Now that you have several master items, you should edit Sheet 1. will not add the file to your hub).

- Add a Bar chart, Pie chart, and KPI to the sheet.


- Use the Master items ( ) section in the assets panel to drag &
drop dimensions and measures to populate each chart as follows:

Bar chart
Dimension = Account Description
Measures = Actual Expense Total, Expense Budget Total

Pie chart
Dimension = Account Type
Measures = Number of Accounts

KPI
Measures = Actual Expense Total, Expense Budget Total

© 2018 QlikTech International AB. All rights reserved. Qlik®, Qlik Sense®, QlikView®, QlikTech®, Qlik Cloud®, Qlik DataMarket®, Qlik Analytics Platform®, Qlik NPrinting®,
Qlik Connectors®, Qlik GeoAnalytics®, Qlik Core®, Associative Difference®, Lead with Data™, Qlik Data Catalyst™, Qlik Associative Big Data Index™ and the QlikTech logos
are trademarks of QlikTech International AB that have been registered in one or more countries. Other marks and logos mentioned herein are trademarks or registered
trademarks of their respective owners.
Master Measures to Save Expressions
• Create three new master measures.

- Create a master measure with the following expression:


Sum([Sales Quantity] * [Sales Price])
Name the new master measure: “Revenue”.

- Create a master measure with the following expression:


Sum(AROpen)-Sum(ARCurrent)
Name the new master measure: “Amount Overdue”.

- Create a master measure with the following expression:


Sum(ARAvgBal)/Sum(ARSalesPerDay)
Name the new master measure: “Days Sales Outstanding”.

• Edit the charts which already exist on Sheet 2 to use these new master measures.

- Add Revenue as a measure on the Treemap.

- Add Revenue as a measure on the Bar chart.

- Add Amount Overdue as a measure on the Pie chart.

- Add Days Sales Outstanding and Amount Overdue as measures on the Scatter plot.

Drill-down Dimension
• Create a new master dimension which relates product groupings.

- Make the new dimension a Drill-down with the following fields:


Product Group Desc
Product Type Desc
Product Sub Group Desc
- Name this new drill-down dimension: “Product Hierarchy”.

• Edit Sheet 3.

- Add the new drill-down dimension, Product Hierarchy, to the partially-configured bar chart.

© 2018 QlikTech International AB. All rights reserved. Qlik®, Qlik Sense®, QlikView®, QlikTech®, Qlik Cloud®, Qlik DataMarket®, Qlik Analytics Platform®, Qlik NPrinting®,
Qlik Connectors®, Qlik GeoAnalytics®, Qlik Core®, Associative Difference®, Lead with Data™, Qlik Data Catalyst™, Qlik Associative Big Data Index™ and the QlikTech logos
are trademarks of QlikTech International AB that have been registered in one or more countries. Other marks and logos mentioned herein are trademarks or registered
trademarks of their respective owners.
Exercise Instructions | page 2
Drill-down Dimension (cont’d)
• Use the Done button in order to toggle out of edit mode, and use the Drill-down capability which
is now available in the bar chart on Sheet 3.
- Select the Frozen Foods bar and confirm. What happens to the bar chart?
(Answer: The second level of the drill-down hierarchy, Product Type Desc, is revealed.)

- Clear all selections.


- Select the Alcoholic Beverages bar and confirm. What happens to the bar chart?
(Answer: The third level of the drill-down hierarchy, Product Sub Group Desc, is revealed,
because there is only one value at the second level of the drill-down hierarchy for Alcoholic
Beverages: Beer and Wine.)

- Clear all selections.

Making a Master Visualization


• Return to Sheet 2.

- Make the donut-shaped Pie chart, titled Amount Overdue by Customers, into a master
visualization (be certain that you are toggled into Edit mode).
- What happens to the Properties panel once this pie chart becomes a Master item?
(Answer: Because it is a ‘Linked visualization’, the properties cannot be edited directly,
but they can be edited if you click the Edit button which is presented in the properties
panel. Or, you may use the Master items ( ) section in the assets panel in order to
edit ( ) this master visualization.)

• Edit the Master visualization, Amount Overdue by Customers.

o In the Data section of the Properties panel, expand the Customer dimension and change
the Limitation to show the top 20 instead of the top 10 customers. Click Done to apply
the change.

© 2018 QlikTech International AB. All rights reserved. Qlik®, Qlik Sense®, QlikView®, QlikTech®, Qlik Cloud®, Qlik DataMarket®, Qlik Analytics Platform®, Qlik NPrinting®,
Qlik Connectors®, Qlik GeoAnalytics®, Qlik Core®, Associative Difference®, Lead with Data™, Qlik Data Catalyst™, Qlik Associative Big Data Index™ and the QlikTech logos
are trademarks of QlikTech International AB that have been registered in one or more countries. Other marks and logos mentioned herein are trademarks or registered
trademarks of their respective owners.
Exercise Instructions | page 3
Color Based on Master Measure
• Return to Sheet 3.

o Drag & drop the master measure Actual Expense Total to the bar chart. Replace the
Sum([Sales Price]) measure.

o In the assets panel, edit the Actual Expense Total master measure to color items yellow.

▪ Notice that the bars in the bar chart on this sheet are colored yellow.

o Return to Sheet 1, and notice that bars in the bar chart on this sheet associated with this
master measure are colored yellow, and the KPI value associated with this master
measure is also colored yellow.

Custom Color Scheme Based on Master Dimension Values


• Note the colors currently applied to the pie chart.

• Edit the Account Type master dimension.

o Use the Value colors tab to assign specific colors to each of


the values as follows:

▪ General Costs = #009688


▪ Other Costs = #E91E63
▪ Staff Costs = #FF9800
▪ Null values = #323132

o Notice the impact that this custom color scheme has had on
the pie chart.

© 2018 QlikTech International AB. All rights reserved. Qlik®, Qlik Sense®, QlikView®, QlikTech®, Qlik Cloud®, Qlik DataMarket®, Qlik Analytics Platform®, Qlik NPrinting®,
Qlik Connectors®, Qlik GeoAnalytics®, Qlik Core®, Associative Difference®, Lead with Data™, Qlik Data Catalyst™, Qlik Associative Big Data Index™ and the QlikTech logos
are trademarks of QlikTech International AB that have been registered in one or more countries. Other marks and logos mentioned herein are trademarks or registered
trademarks of their respective owners.
Exercise Instructions | page 4
Custom Color Scheme Based on Master Measure Values
• Return to Sheet 2.

• Edit the Account Overdue master measure.

o Use the Segment colors tab to configure the following


settings for a custom color scheme:

▪ Segment colors = Custom.

▪ Select a template scheme = Basic.

▪ Segment format = Percentage.

▪ Click to Add limit.


• Set lower limit at 30%.

• Set lower limit at 70%.

▪ Color lower segment = #f90616.


▪ Color middle segment = #fcff0e.
▪ Color higher segment = #349334.
▪ For both limits, check the Gradient checkbox.

o Save the changes to this master measure.

• Edit the properties of the pie chart to show this custom color scheme.

o After agreeing to Edit this ‘Linked visualization’, visit the Appearance section, Colors
and legend subsection of the properties panel.

▪ Change the Library colors switch to On.

o Click Done to complete these property changes to this master visualization.


• The resulting pie chart should appear as you see below.

© 2018 QlikTech International AB. All rights reserved. Qlik®, Qlik Sense®, QlikView®, QlikTech®, Qlik Cloud®, Qlik DataMarket®, Qlik Analytics Platform®, Qlik NPrinting®,
Qlik Connectors®, Qlik GeoAnalytics®, Qlik Core®, Associative Difference®, Lead with Data™, Qlik Data Catalyst™, Qlik Associative Big Data Index™ and the QlikTech logos
are trademarks of QlikTech International AB that have been registered in one or more countries. Other marks and logos mentioned herein are trademarks or registered
trademarks of their respective owners.
Exercise Instructions | page 5
Create and apply an Alternate state
• With Sheet 2 viewed in ‘analyze’ mode, select the Supermarkets dimension in the Revenue by
Sales Rep treemap.

o Notice that the data in the scatter plot, bar chart, and pie chart adjust to show only the
‘Supermarkets’ SegmentDesc value.

o Clear the selection, and toggle the sheet into Edit mode.

• In the Master items section of the assets panel, open the Alternate states subsection.

o Create a new alternate state, named: “Special selections”.

o Drag & drop this new alternate state onto both the treemap and the scatter plot on this
sheet, and Apply state.

• Click the Done button to toggle the sheet back to ‘analyze’ mode.

o Select the Supermarkets dimension in the Revenue by Sales Rep treemap.

▪ Note that the scatter plot will adjust to this selection, but the bar chart and pie
chart do not represent this special selection state.

o In the Amount Overdue by Customers pie chart, select the sectors corresponding to the
following two customers: Valley Solutions and RFI Corporation.

▪ Note that the treemap and the scatter plot do not respond to this selection made
to the ‘default’ selection state.

Publishing an App
• If you have access to a Qlik Sense Enterprise deployment, try importing your app and publishing
in that environment. What master item content is available in the published app?

Answer:
- Master items, including Dimensions, Measures, and Visualizations,
are available for other users to build their own sheets.

- Alternate states are also available for the users of a published app
to apply to visualizations which they create.

© 2018 QlikTech International AB. All rights reserved. Qlik®, Qlik Sense®, QlikView®, QlikTech®, Qlik Cloud®, Qlik DataMarket®, Qlik Analytics Platform®, Qlik NPrinting®,
Qlik Connectors®, Qlik GeoAnalytics®, Qlik Core®, Associative Difference®, Lead with Data™, Qlik Data Catalyst™, Qlik Associative Big Data Index™ and the QlikTech logos
are trademarks of QlikTech International AB that have been registered in one or more countries. Other marks and logos mentioned herein are trademarks or registered
trademarks of their respective owners.
Exercise Instructions | page 6

You might also like