Concept of Star Schema and Synthetic Key in QlikView

Last updated on Nov 01 2021
Zubin Kamdin

Table of Contents

Concept of Star Schema and Synthetic Key in QlikView

A start schema model is a type of data model in which multiple dimensions are linked to a single fact table. Of course, in bigger models there can be multiple facts tables linked to multiple dimensions and other fact tables. The usefulness of this model lies in performing fast queries with minimal joins among various tables. The fact table contains data, which are measures and have numeric values. Calculations are applied on the fields in the fact table. The unique keys of the dimension tables are used in linking it to the fat table, which also has a key usually with the same field name. Therefore, the Fact table contains the keys from the entire dimension table and forms a concatenated primary key used in various queries.

Input Data

Given below is a list of tables, which contain the data for different products from various suppliers and regions. Also the supply happens at different time intervals, which are captured in the Time dimension table.

Product Dimension

It contains the Product Category and Product Names. The Product ID field is the unique Key.

ProductID,ProductCategory,ProductName
1,Outdoor Recreation,Winter Sports & Activities
2,Clothing,Uniforms
3,Lawn & Garden Power, Equipment
4,Athletics,Rugby
5,Personal Care,Shaver
6,Arts & Entertainment,Crafting Materials
7,Hardware,Power Tool Batteries

Region Dimension

It contains the Region Names where the suppliers are based. The RegionID field is the unique Key.

RegionID,Continent,Country
3,North America, USA
7,South America, Brazil
12,Asia,China
2,Asia,Japan
5,Europe,Belgium

Supplier Dimension

It contains the Supplier Names, which supply the above products. The SupplierID field is the unique Key.

SupplierID,SupplierName
3S12,Supre Suppliers
4A15,ABC Suppliers
4S66,Max Sports
5F244,Nice Foods
8A45,Artistic angle

Time Dimension

It contains the Time periods when the supply of the above products occur. The TimeID field is the unique Key.

TimeID,Year,Month
1,2012,Feb
2,2012,May
3,2012,Sep
4,2013,Aug
5,2014,Jan
6,2014,Nov

Supplier Quantity Fact

It contains the values for the quantities supplied and percentage of defects in them. It joins to each of the above dimensions through keys with same name.

ProductID,RegionID,TimeID,SupplierID,Quantity, DefectPercentage
1,3,3,5F244,8452,12
2,3,1,4S66,5124,8.25
3,7,1,8A45,5841,7.66
4,12,2,4A15,5123,1.25
5,5,3,4S66,7452,8.11
6,2,5,4A15,5142,3.66
7,2,1,4S66,452,2.06

Load Script

The above data is loaded to QlikView memory by using the script editor. Open the Script editor from the File menu or press Control+E. Choose the Table Files option from the Data from Files tab and browse for the file containing the above data. Click OK and press Control+R to load the data into QlikView’s memory. Below is the script which appears after each of the above file is read.

LOAD ProductID,
ProductCategory,
ProductName
FROM
[C:\Qlikview\images\StarSchema\Product_dimension.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

LOAD TimeID,
Year,
Month
FROM
[C:\Qlikview\images\StarSchema\Time.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

LOAD SupplierID,
SupplierName
FROM
[C:\Qlikview\images\StarSchema\Suppliers.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

LOAD RegionID,
Continent,
Country
FROM
[C:\Qlikview\images\StarSchema\Regions.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

LOAD ProductID,
RegionID,
TimeID,
SupplierID,
Quantity,
DefectPercentage
FROM
[C:\Qlikview\images\StarSchema\Supplier_quantity.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

Star Schema Data Model

After reading the above data into QlikView memory, we can look at the data model, which shows all the tables, fields, and relationship in form of a star schema.

Concept of Star Schema and Synthetic Key in QlikView
Concept of Star Schema and Synthetic Key in QlikView

QlikView – Synthetic Key

A Synthetic Key is QlikView’s solution to create an artificial key when there is ambiguity about which key to use between two tables. This situation arises when two tables have two or more fields in common. QlikView’s feature of creating association in memory automatically detects this scenario and creates an additional table, which will hold the value of the new key created.

Input Data

Let us consider the following two CSV data files, which are used as input for further illustrations.
Sales:

ProductID,ProductCategory,Country,SaleAmount
1,Outdoor Recreation,Italy,4579
2,Clothing,USA,4125
3,Costumes & Accessories,South Korea,6521

Product:
ProductID, Country
3,Brazil
3,China
2,Korea
1,USA

Load Script

We load the above input data using the script editor, which is invoked by pressing Control+E. Choose the option Table Files and browse for the Input file.

Concept of Star Schema and Synthetic Key in QlikView
Concept of Star Schema and Synthetic Key in QlikView

Data Model

Next, we look at the data model by using the menu command for table viewer, Control+T. The following screen comes up, which shows the creation of a third table that supplies the value of the synthetic key as both the tables have ProductID and Country as matching keys.

Concept of Star Schema and Synthetic Key in QlikView
Concept of Star Schema and Synthetic Key in QlikView

Impact of Synthetic key

Synthetic keys indicate the flaw in the data model that is being used. They do not cause any issue in the correctness of the data or performance of the report. Things will work fine if a big data model has one or two instances of synthetic keys. However, if we have too many of them, then that is an implication to redesign the data model.

So, this brings us to the end of blog. This Tecklearn ‘Concept of Star Schema and Synthetic Key in QlikView’ blog helps you with commonly asked questions if you are looking out for a job in QlikView BI. If you wish to learn QlikView and build a career in Business Intelligence domain, then check out our interactive, QlikView Certification Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

Qlik View Certification Training

QlikView Certification Training

About the Course

Tecklearn’s QlikView Certification Training will help you become an expert in Data Visualization with QlikView. Learn all the basics and advanced features of QlikView such as data modelling, reports and dashboards, visualization, object formatting, system table etc. Along with this, you will be given hands-on working experience on real-time projects that will help you pass the QlikView certification exam. You also get hands-on experience in QlikView applications.

Why Should you take QlikView Training?

• The average annual pay for a QlikView Professional is $122,000. -PayScale.com.
• Deloitte, Cisco, Qualcomm, Sony, AON & other top Fortune 500 companies use QlikView
• QlikView – A Leader in 2017 Gartner Magic Quadrant for Business Intelligence & Analytics Platforms (For 7th Consecutive Year).

What you will Learn in this Course?

Introduction to QlikView

• Concept of Business Intelligence
• Features and components of QlikView
• Comparison with other BI tools
• Architecture
• Installation & Navigation
• QVS, QVW and .log files
• Sheet Objects
• Dimensions and Expressions
• Various file types and extensions

Various QlikView Products

• Overview of the various QlikView products

Introduction to Data and Scripting

• Structuring the Script
• Create tabs in the scripts, Debugging of scripts
• Hands On

Data Model

• QlikView Data File Types: QVD, QVX
• System fields
• Star schema
• Synthetic Key Tables
• Data Modelling Considerations
• Straight and Pivot Table
• Hands On

Components of Qlik View

• Sheets and Sheet Objects
• The List Box
• The Table Box
• The Multi Box
• The Button & Text Object
• Basic Charts
• Hands On

Set Analysis

• Set analysis
• Working with modifiers, identifiers, operators, example of expressions,
• Indirect set analysis
• YTD & MTD

QlikView Functions, Reports and Charts

• Uses of Expressions
• Chart Properties: Dimensions
• Qlikview Functions
• Adhoc Reports
• Incremental Load using QVD Files
• Bookmarks
• Hands On

Data Analysis

• What-if Analysis
• Comparative Analysis
• Dynamic Reporting or Ad-hoc Reporting
• Document Analyzer

QlikView Security

• QlikView security
• Defining the access controls and levels of access
• Maintaining the access control database

QlikView Administration

• QMC (QlikView Management Console)
• Server Installation & Deployment
• QlikView Project

Got a question for us? Please mention it in the comments section and we will get back to you.

0 responses on "Concept of Star Schema and Synthetic Key in QlikView"

Leave a Message

Your email address will not be published. Required fields are marked *