You are on page 1of 158

QlikView Developer Version 11

Michael Alegado

Agenda
9:00 am 5:00 pm Break at 9:45 or as needed Lunch 11:30 or 12:00 for 1 hour Break at 3:00 pm or as needed Questions/discussions throughout

Agenda
INTRODUCTION QLIKVIEW DEVELOPMENT METHODOLOGY DEPLOYMENT INTRODUCTION TO DATA AND SCRIPTING BASIC SCRIPT SYNTAX STRUCTURING THE SCRIPT BASIC DATA MODEL AND TABLE VIEWER BASIC DATA TRANSFORMATION ADDING TEXT DATA

Agenda
GENERATING DATA IN THE QLIKVIEW SCRIPT SCRIPTING CONSIDERATIONS QLIKVIEW DATA (QVD) FILES MAPPING TABLES LOADING BUDGET DATA DATA MODEL OPTIMIZATION ADVANCED CALCULATIONS IN SHEET OBJECTS SCRIPTING AND DATA MODELING CHALLENGES PERFORMANCE OPTIMIZATION QLIKVIEW SECURITY

Introductions Please mention


Your name Company / Department Your experience with QlikView Your expectations for the course How do you use QlikView in your job?

Lesson 1 Introduction

Learning Objectives
Explain the difference between QlikTech and QlikView Identify what is business discovery Identify the QlikView product family

About this Course


Possessing a deep knowledge of the data model, creation of the proper data connections and scripting fundamentals are critical to creating QlikView documents Beginning with QlikView environment and ending with an introduction to advanced interface design

Definition of a QlikView Developer and System Administrator


The QlikView Developer The QlikView System Administrator

QlikView
QlikView is a Business Discovery platform Data presented in easy to understand format Manages information Associative connections

About QlikTech
Software company Founded in Lund, Sweden in 1993 Founded on the belief that business intelligence (BI) should be about the business user

Lesson 2 QlikView Development Methodology

Learning Objectives
Identify the importance of Document/Sheet XML Import/Export Review Project Plan State the QlikView deployment options

What is QPM?
QPM = QlikView Project Methodology is a description of all project management activities, documents and QlikView Deliverables in all the phases of a QlikView project By using this Project Methodology we will be able to make a difference in the customer experience and making the best use of the QlikView capabilities.

QPM Framework
Execution

Pre-Study
Start-Up Project
Business Objectives Prepare Enterprise Platform

Planning
Project Plan
Prioritized Business Requirements Define Enterprise Platform Build

Test

Implementation
Multiple Apps User Review Deployment User Communication Refine Realize Enterprise Platform

Conclusion
Evaluation Hand Over Lessons Learned Project Completion

Transition to: Self Service BI Governance & Support

TG 0

TG 1

TG 2

TG 3

TG 4

TG 5

Start

Proceed

Start Cycle(s)

Finish Cycle(s)

Go-Live Apps

Close

Benefits
Better and more Engagement with our Enterprise Customers Direct Influence on succes and our own mission Control and Quality QPM helps frame the potential growth for QlikView Manage our customers expectations for the investment in resources, training and hardware. Great feedback loops for QT Sales, Product Development, Marketing Strenghten our partnerships with more action together! Effective Sales Cycles Great opportunities for ES Consultants

Lesson 3 Deployment

Learning Objectives
State the QlikView deployment options Identify the functional and business benefits of each example deployment option

Components of QlikView Business Discovery Platform

QlikView Overview

QlikView Product Platform


With QlikView Personal Edition you can make full use of the QlikView functionality, but it is not possible to open documents created by other users. Please contact your sales account executive for information regarding QlikView licenses.

QlikView Product Platform


QlikView Desktop is a single point of interaction for collecting data, designing analytics, and building dashboards and reports.

QlikView Product Platform

QlikView Server supports the following clients: Browser-independent, downloadfree Ajax client Installed Windows client Internet Explorer browser plug-in Apple iPad and iPhone Android devices BlackBerry

QlikView Product Platform


QlikView Publisher helps organizations balance the need for widespread distribution of analytic functionality and reports with the requirement to maintain centralized control and administration of sensitive corporate data.

Stand Alone/QlikView Desktop

QlikView Server

QlikView Server & Publisher

Project Plan
QWT Business Intelligence Project Plan

Standard QlikView Deployment

Lesson 4 Introduction to Data and Scripting

Learning Objectives
Identify what is a relational database Identify what is a data structure Review the QWT.mdb database Use the QlikView Script Editor

Relational Data Base Management Systems


MySQL Microsoft SQL Server Microsoft Access Oracle DB2 Sybase Informix Teradata

Relational Databases

Table

Field

Key Field

Data Structures: Star Schema


Dimension Dimension Dimension

Fact Table

Dimension

Dimension

Dimension

Data Structures: Snowflake Scheme

Dimension

Dimension

Dimension Dimension Dimension Dimension

Dimension
Dimension Dimension

Fact
Dimension Dimension Dimension

Dimension

Dimension

Data Structure in QlikView

Data Structure in QlikView

Data sources in this course

Lesson 5 Basic Script Syntax

Learning Objectives
Identify common QlikView Syntax State the difference between Connect, Select, and Load statements Create a working Connect statement

Basic Script Syntax


CONNECT Used to connect with ODBC or OLEDB interface Is automatically created when using the wizard

SQL SELECT Instructs which field and tables to retrieve automatically created when using the wizard

LOAD Defines what transformations of data should be invoked by QlikView

How QlikView reads a load script


LOAD SELECT LOAD

2 1

SELECT
3

What is a key field?


A field that exists in two tables and connects the two.

Lesson 6 Loading Data from the Database

Learning Objectives
Comment the script for future reference Load data with the QlikView Script Editor Access the Debugger

Commenting the Script


REM // /* */ (following table) (single line) (start) (finish)

Using keys: Comment: Ctrl+k(v.8.5) Ctrl+k+c (v.9.0+) Uncomment: Ctrl+SHIFT+k(v.8.5) Ctrl+k+u(v.9.0+)

Connecting to databases
ODBC (Open DataBase Connectivity)

OLE DB (Object Linking and Embedding, Database) More advanced way to connect to databases, also multidimensional databases possible) The CONNECT statement generated, applies to all following SELECT statements until a new CONNECT statement is made.

Load Script basics


/*-----------------Customers Table ------------------*/ Customers: LOAD Address, City, CompanyName, Phone, PostalCode, StateProvince; SQL SELECT * FROM Customers;
Comments Table name

Preceding load; allows modifying QV datamodel

SQL statement retrieving data from database

OLE DB

ODBC

Lesson 7 Structuring the Script

Learning Objectives
State why creating tabs can be beneficial when structuring a QlikView Script Create tabs to structure your script

Often when building a QlikView application, many tables are used and sometimes you want to manipulate existing tables. To make the script easier to work with, we divide the script into different tabs

Synthetic keys
Complex Key(s) consisting of two or more fields between two connecting tables.
Implications Resource heavy Slows down calculations Makes a document harder to understand and maintain How can it be removed? Selectively remove double fieldnames Rename fieldnames Use qualify statement

Lesson 8 Basic Data Model and Table Viewer

Learning Objectives
Use the Table Viewer to analyze the internal structure of a QlikView document Identify how the Table Viewer can be used to debug problems

Lesson 9 Basic Data Transformation

Learning Objectives
Define the advanced uses of the script editor Rename Fields Use transformative Functions in the script

Load Statement
The load statement loads Fields from a typed ASCII file, from data defined in the script, from a previously loaded table, from the result of a following select statement or by generating data automatically. The general syntax of the load statement is:
load [ distinct ] *fieldlist [( from file [ format-spec ] | from_fieldfield [format-spec] inline data [ format-spec ] | residenttable-label | autogenerate size )] [ where criterion ] | while criterion ] [ group_by fieldlist ] [order_by field [ sortorder ] { , field [ sortorder ] }

Renaming Fields

Key Fields Predicament


Consequences:
Not possible to use the frequency information Not possible to use all functions when creating chart expressions (only distinct)

Solution:
Use distinct Load the field an extra time under a new name Load a record counter

Key Fields Solution, Count


LOAD ,
OrderID, OrderID AS OrderIDCount

FROM Orders;

You can now use the new field (not associated) in a list box that shows the frequency or a chart with functions to calculate the frequency.

Key Fields Solution, Record Counter


LOAD ,
OrderID, 1 AS OrderRecordCounter,

FROM Orders;

This way of solving the problem is more efficient when working with large amounts of data since a sum of a numeric value takes very little power compared to a count of a value.

Lesson 10 Adding Text Data

Learning Objectives
Review data sources from Excel spreadsheets Use the File Wizard to load data into QlikView Transform (rename a field) data with the File Wizard

Loading Data from a Table File

Loading Data from a Table File

Connecting to other datasources


DATA from files Absolute vs Relative Paths
[C:\QlikViewTraining\Developer\Datasources\EmpOff.xls] (biff, embedded labels, table is Employee$); Datasources\EmpOff.xls (biff, embedded labels, table is Employee$);

Lesson 11 Generating Data in the QlikView Script

Learning Objectives
Use Resident Load Create Data from Other Data and Autogenerate Load Data using External Scripts with Include Create a Master Calendar

Use Resident Load


How to create a new logical table in QlikView, based on a previously loaded (resident) table

Create Data from other Data

Load Data Using External Scripts


It is possible to include references to files in a script that themselves contain script or parts of a script.

OrderDetails
Order By OrderDate ASC peek 0 OrderDate 2007-04-19

Variable LET varMinDate varMaxDate

Temp Calendar
DateField Autogenerate varMaxDate varMindate TempDate

Master Calendar
TempDate as OrderDate -1 2012-03-29 RESIDENT DateField

Lesson 12 Scripting Considerations

Learning Objectives
Create a Synthetic Key Identify Circular References Define Loosely Coupled Tables State why these conditions should be avoided

What is a Synthetic Key


A Synthetic Key is created in the script when multiple fields are linking one or more tables together.

Why not Synthetic Keys?


Are resource heavy Slow down calculations In extreme cases, overlaod an QlikView document Make a document harder to maintain and understand

How can Synthetic Keys be Avoided?


Rename fields using AS or QUALIFY Comment out fields that are not needed Concatenated key - combining field names and creating a unique key field

Circular References

Circular References
QlikView solves the problem by Loosely coupled tables

Lesson 13 QlikView Data (QVD) Files

Learning Objectives
Define QVD files Explain why QVD files are so important Create a QVD file manually Generate a QVD file automatically

QVD File Format


Contains one table Composed of A well formatted XML Header Symbol tables in a byte stuffed format Actual table data in a bit-stuffed format

Use of QVD Files


Increasing Load Speed Decreasing Load on Database Servers Consolidating Data from Multiple QlikView Documents Incremental Load

Lesson 14 Mapping Tables

Learning Objectives
Identify when to use mapping tables Create mapping tables to add Quarters to the Orders table Identify areas to clean up in the table structure

Mapping Tables
Mapping prefix Must have two columns

Exercise: Mapping Tables

Cleaning up the Table Structure


Minimize the number of tables in QlikView If you have tables with only two fields, map those tables to minimize the number of tables

QlikView Developer Course

Lesson 15 Loading Budget Data

Learning Objectives
Identify cross tables Use the File Wizard to transform the data and create load script

Cross Tables
A cross table is a common type of table featuring a matrix of values between two orthogonal lists of header data.

Lesson 16 Data Model Optimization

Learning Objectives
Review key measures Use, Conditions in tables, Aggregation, Joining tables and Pre-ceding Load on Preceding Load within the script

Condition on a Field Table


The Category Type field can be created by using the CategoryID field. If the CategoryID is 5 or 6, the CategoryType should be Footwear, otherwise the type should be clothing.

Aggregating Data
Group by is a clause used for defining over which fields the data should be aggregated (grouped)

Joining Tables
It is possible to join tables already in the script The join between tables can be performed against the source database or you can use a QlikView Join command

Concatenation
Concatenation can be used to join data together from multiple tables Automatic Concatenation Forced Concatenation Prevent Concatenation

Exercises: Advanced Scripting


Condition on a Field in a Table Aggregation Joining Tables Preceding Load on Preceding Load

Lesson 16 Advanced Scripting

Objectives
Introduce advanced calculations in charts and tables, including: Dimension Limits Set Analysis Dollar-Sign Expansion AGGR Function Complete exercises using examples of each of these functions

Dimension Limits
New capabilities for a chart to show totals, other segments and limit to top/bottom performing dimension values Moves these features into the cube vs. the presentation layer Consistency across charts New capabilities will simplify numerous chart acrobatics from earlier releases

Have you ever tried to


Restrict a table or chart based on a the contribution of a dimension to the total? Summarize non-displayed dimensions as OTHERS without resorting to a pie chart? Evaluate lower level dimensions either locally or globally? Use these as qualification criteria to determine what to display in table or chart?

Define Dimension Limits


Show only Show only values that are Show only values that accumulate to Options Others Total Global Grouping

Show Only Values That Are:

Show Only Values That Accumulate To:

Dimension Totals

Set Analysis

What is Set Analysis

Conceptually similar to a selection.


Provides a method of defining groups (sets) of information that are independent of the current selections.

Can create sets based on other sets. Must be used in aggregation expression. Always begin and end with curly brackets {}

Set Analysis Why?


Very powerful functionality for comparison analysis. May eliminate the need for additional, complex coding within an application Provides much more flexibility in the analysis you can create

Set Analysis Syntax


The syntax is broken down into 3 categories:
Identifiers Operators Modifiers

Set Analysis Identifiers


There is one constant that can be used to denote a record set; 1 represents the full set of all the records in the document. The $ sign represents the records of the current selection. The set expression {$} is the equivalent of not stating a set expression at all {1-$} defines the inverse of the current selection, that is, everything that the current selection excludes.

Identifiers
Examples: sum({1} Sales) Returns total sales within the application, disregarding selections but not the dimension. sum({$} Sales) Returns sales for the current selection, i.e. the same as sum(Sales).

sum({BM01} Sales) Returns sales for the bookmark ID BM01.

Set Modifiers

A set can be modified by additional or changed selections. Such a modification can be written in the set expression. The modifier consists of one or several field names, each followed by selection(s) that can be made in the field. Modifiers begin and end with angle brackets <>.

Modifiers - Examples
sum({$<OrderDate = DeliveryDate>} Sales) Returns the sales for the current selection where OrderDate = DeliveryDate. sum({1<Region = {US}>} Sales) Returns the sales for region US disregarding the current selection. sum({$<Region = >} Sales) Returns the sales for current selection, but with the selection in Region removed. sum({<Region = >} Sales) Returns same as the example above. When the set to modify is omitted, $ is assumed. sum({$<Year={2000}, Region={U*}>} Sales) Returns the sales for current selection, but with new selections both in Year and in Region.

Example of Set Analysis

Example of Set Analysis

Dollar-Sign Expansion

AGGR Function
AGGR is a powerful QlikView function that returns a set of values of expression calculated over dimensions. The table shows information on how many customers have placed one order, two orders etc, and also the average order value.

Comparative Analysis Drives Deeper Insight


Multiple selection states against one data set Set up objects to reference a selection state Compare and calculate among states

Comparative Analysis in QlikView 11

Comparative Analysis: Overview


New capability for comparing sets of the data

Eliminates often used techniques involving macros, duplicated data model


Most common cases
Ad hoc groupings Regression comparison

All work dependent on development (vs. explicit end user functions)

Comparative Analysis - Illustration


Allow for multiple selection states against one data set Setup document components to reference a selection state Compare, calculate between states

Comparative Analysis A Comparison


Method Technique Level Flexible Multiple Visibility

Coverage

Set Reference

Select, context menu, select

Selection (list box)

No. Must clear reference & reset

No

No

End user defined. No Ajax

Detach/ Attach

Select, context menu, select

Object

No. Must clear lock

Yes

No

End User Defined. No Ajax

Bookmark

Select, save.

Expression

Yes. Can update bookmark

Yes

No

Developer predefined. End user modified. All clients

Alternate State

Define labels, assign objects, make selections

Sheet, object, expression

Yes. End user can adjust selections independently.

Yes

Yes

Developer predefined. End user content. All clients

Comparative Analysis Demonstration


Simple demonstration Existing QlikView techniques for comparing data sets Using alternate state for comparing data sets

Comparative Analysis - Discussion


Comparative Analysis is most likely to
Simplify design of like-to-like comparison problems

Allow us to enter new problem spaces (what?)


Eliminate use of (need for) other comparative techniques (set reference, detach etc) Not be used. Why? What should comparative analysis mean to users (vs. developers)?

Comparative Analysis How To

State Identifiers Standard Identifiers

Assign
Tie sheets & objects to Alternate States

Simplify design

Use
User Interactions

Define

Inherit

Comparative Analysis - Define

Comparative Analysis - Assign

1. 2. 3. 4.

Sheet assignment Container assignment List box assignment Expression assignment

Alternate States New Function


Testing for a State
Conditioning elements on an alternate state thru a new function Statename()

Examples Dynamic Text


='Region - ' &if(StateName() = '$', 'Default', StateName())

Dynamic Colors
if(StateName() = 'Group 1', rgb(152, 171, 206), if(StateName() = 'Group 2', rgb(187, 200, 179), rgb(210, 210, 210) ) )

Comparative Analysis Inheritance

DOCUMENT (Default Only)

Comparative Analysis Inheritance

SHEET (Default, Inherit, Named)

Comparative Analysis - Inheritance

CONTAINER (Default, Inherit [Sheet], Named)

Comparative Analysis - Inheritance

SHEET OBJECT/CONTAINED OBJECT (Default, Inherited, Named)

Comparative Analysis - Inheritance

EXPRESSION (Default, Inherited [Object], Named)

Comparative Analysis Additional


Clear
Affects all states or can be selective via new menu off CLEAR button

State Navigation & Lock/Unlock


All states

Linked Objects
If the copied object has a setting of INHERIT, it may perform differently in another location (sheet/container) WHY?

Comparative Analysis Additional


Actions
Can be invoked on a particular state
E.G. CLEAR

New actions
Selection: COPY STATE (to a new state) Selection: SWAP STATE (exchange selections in 2 named states) Layout: ASSIGN STATE (to an object) Build more dynamic UIs to provide user with sense of state definition

See Demo

Lesson 18 Scripting and Data Modeling Challenges

Objectives
Explain the use link tables Calculate net change within a field Use advanced functions for handling time Identify why dynamic aggregation and interval matching are important

Link Tables

Date Island

Interval Match

Lesson 19 Performance Optimization

Objectives
Discuss performance tuning Explore the impacts of appropriate document design Introduce security concepts Review best practices

Lesson 20 QlikView Security

Objectives
Identify the components of QlikView document security Explain access control and restrictions Practice implementing QlikView Section Access

Business Case Workshop

Objectives
Build a working QlikView analysis application
Review business requirements Review data sources Plan development effort Build application

Review and discuss with instructor/students

Scenario
ACME Inc., is a food & drink distributor selling to different types of stores across the United States and also internationally. They are interested in getting a better understanding of their Sales and Margin performance across their business. They have asked you to develop a Sales Analytics QlikView application for them. The application will be used by their top executives, their product managers and also their salespeople.

Thank You.