Contact Us

Kockpit is here to help you

Business Form

Qlik Mastery: A Comprehensive Guide to the Three-Tier Architecture

Architecture is a great way to structure frameworks for designing systems, offering benefits such as clarity, scalability, interoperability, ease of maintenance, and security. 


Similarly, the Three-tier architecture in Qlik Sense allows you to build robust, scalable, and secure data analytics applications! 


This article will cover all the basics you need to know about the Three Tier Architecture. 


Tier One: Data Extraction in Qlik Sense

As the name suggests, the data extraction phase of the analytics begins in this tier. Client data is extracted from one of the several data sources supported by Qlik Sense (80+ data sources). Data Sources also include Local Storage, Google Drive, etc. 


Coming to the data format, Qlik Sense supports the following data types: 


Below is the image of a generic data extraction from an Excel file: 


Once the data has been extracted, it needs to be converted into a QVD file and subsequently stored. Below is the code to convert and store as QVD. 


LOAD * 

FROM [path.extension]

STORE table_name INTO [new_name.qvd](QVD);



The advantage of using QVDs is that they are extremely efficient to load (almost 100 times more efficient). This is possible because QVDs compress the data while retaining all filed values! 


NOTE: QVDs are native to Qlik, and thus cannot be loaded/ used in another application. 


Once all the files have been extracted and converted to QVDs, they must be dropped. Below is the code to achieve this.


DROP TABLE tb_name;

DROP TABLES tb1_name, tb2_name, tbN_name;



Overall, in the 1st tier i.e. Extract Layer, the data is extracted from the source, converted to QVDs for performance, and finally dropped. 

Tier Two: Data Transformation 

The entire Second tier can be categorized into 3 parts, as represented below: 


Let's delve into each category. 


Data Modeling in Qlik Sense 


The data model is made using either the Star or Snowflake schema. A Star Schema contains one or more fact tables (tables that undergo frequent transactions, ex: Orders Table) in the center and multiple-dimension tables (tables that undergo infrequent transactions, ex: Employee Table). Below is the representation for both. 


The Star schema is modeled by joining relevant tables. Once this is done, all the tables are joined to create a single table. The below table will be obtained when all the tables are joined! 


The reason all fields are joined into a single table (known as denormalization) is because it drastically boosts read performance, which is a key requirement for Analytics Applications (known as OLAP). 


NOTE: Sometimes it’s not possible to join all tables to form a single table.

  

Creating a Master Calendar in Qlik Sense


The Master Calendar is a dimension table that is linked to fact time via a common date field. The Master Calendar contains all dates between the minimum and maximum of the date in the fact table. Confused?😄 


Suppose you have an Orders Table with a date field order_date. Intuitively, the first-ever order to be made will have the minimum date (say it was 1/1/2014) while the last order will have the maximum date (say yesterday).


Thus, the Master Calendar will have all dates starting from 1/1/2014 to yesterday! 


NOTE: The maximum date is dynamic, meaning it will change as and when an order is placed on a new date. 


Usually, clients desire the dates to adhere to the Financial Calendar, which generally begins on the 1st of April and ends on the 31st of March. 


Here is a list of useful links to help you create a Master Calendar: 



Data Transformation in Qlik Sense


This phase includes performing calculations on the fields, data type conversion, bucketing, currency conversions, etc.


Calculations that can be performed on fields are: 

  • Aggregation using Group By.

  • Arithmetic Operations (ex: Multiplying product cost with quantity to calculate total sales).

  • Sorting the data using Order By.


Data type Conversion: 

  • Most date fields are either in string or numeric format, thus they need to be converted to a date format. 


Once you've transformed your data, created a Master Calendar, and created an optimal data model, without dropping any of the tables, it's time to move on to the next stage/ tier. 


Tier Three: Data Presentation 

The final stage is categorized into 3 phases:  


Binary Load in Qlik Sense 

Once you’ve completed the 2nd tier/ stage, you load that application’s data model along with its data into the 3rd tier/ stage. This is accomplished using Binary Load! This means that there is no need to load data from the source! 


There are a few important rules regarding Binary Load implementation: 


  • It has to be written on the first line of the first section. 


  • Only one Binary Load per application is allowed. 

  • Only .qvf files can be loaded. 


Section Access in Qlik Sense 

Usually, clients have this requirement that a particular group/ hierarchy of employees should get to see a particular subset of data. Suppose you have a Sales table containing sales of several regions. You may want employees from the West to see sales pertaining to the West and so on. 


This can be easily implemented using Section Access. The formal definition of Section Access by Qlik itself is: 


“Section Access is used to control the security of an application. It is basically a part of the data load script where you add a security table to define who gets to see what. Qlik Sense uses this information to reduce data to the appropriate scope when the user opens the application, that is, some of the data in the app is hidden from the user based on their identity.” 



Once all of this stage is implemented, you can start creating your visualization and let your creativity go wild. 


Conclusion 

In conclusion, the first tier of the analytics process involves efficient data extraction using Qlik Sense, converting it to QVD files for optimal performance, and subsequent file management.


Moving to the second tier, data transformation encompasses schema modeling, the creation of a Master Calendar, and various data manipulations. 


Finally, the third tier focuses on presentation, featuring Binary Load for seamless data transfer, Section Access for security control, and the freedom to unleash creative visualizations.