Aggregate Functions in QlikView

Last updated on Nov 01 2021
Zubin Kamdin

Table of Contents

Aggregate Functions in QlikView

QlikView Aggregate functions are used to produce aggregate data from the rows of the table. The functions are applied to the columns when creating the load script. Given below is a sample list of Aggregate functions. We also need to apply the Group by clause appropriately when applying the aggregate functions.

• SUM gives the sum of the numeric values of the column.
• AVG gives the average of the numeric values of the column.
• MAX gives the maximum of the numeric values of the column.
• MIN gives the minimum of the numeric values of the column.

Example

Consider the following data stored as product_sales.csv in the local system. It represents the sales figures for different product lines and product category in a store.

Product_Line,Product_category,Quantity,Value
Sporting Goods,Outdoor Recreation,12,5642
Food, Beverages & Tobacco,38,2514
Apparel & Accessories,Clothing,54,2365
Apparel & Accessories,Costumes & Accessories,29,4487
Sporting Goods,Athletics,11,812
Health & Beauty,Personal Care,21,6912
Arts & Entertainment,Hobbies & Creative Arts,58,5201
Arts & Entertainment,Paintings,73,8451
Arts & Entertainment,Musical Instruments,41,1245
Hardware,Tool Accessories,2,456
Home & Garden,Bathroom Accessories,36,241
Food,Drinks,54,1247
Home & Garden,Lawn & Garden,29,5462
Office Supplies,Presentation Supplies,22,577
Hardware,Blocks,53,548
Baby & Toddler,Diapering,19,1247

Creating the Load Script

We open the script editor in a new QlikView document using Control+E. The following code creates the required tables as inline data. After creating this script press control+R to reload the data into the QlikView document.

Aggregate Functions in QlikView
Aggregate Functions in QlikView

Creating Sheet Object

Let us create a Table Box sheet object to show the data generated by the Aggregate function. Go to the menu Layout → New Sheet Object → Table Box. The following window appears in which we mention the Title of the table and the select the required fields to be displayed. Clicking OK displays the data from the CSV file in the QlikView Table Box as shown below.

Aggregate Functions in QlikView
Aggregate Functions in QlikView

Applying SUM() function

Given below is the load script to find the sum of the sales quantity and sales value across the Product Lines and product categories.

Aggregate Functions in QlikView
Aggregate Functions in QlikView

Click OK and press Control+R to reload the data into QlikView document. Now follow the same steps as given above in − Creating Sheet Objects to create a QlikView Table Box for displaying the result of the script as shown below.

Aggregate Functions in QlikView
Aggregate Functions in QlikView

Applying AVG() function

Given below is the load script to create the average of the sales quantity and sales value across each Product Line.
# Average sales of Quantity and value in each Product Line.

LOAD Product_Line,
avg(Quantity),
avg(Value)
FROM
[E:\Qlikview\data\product_sales.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
Group by Product_Line;

Click OK and press Control+R to reload the data into QlikView document. Now follow the same steps as given above in − Creating Sheet Objects to create a QlikView Table Box for displaying the result of the script as shown below.

Aggregate Functions in QlikView
Aggregate Functions in QlikView

Applying MAX() & MIN() function

Given below is the load script to create the maximum and minimum of the sales quantity across each Product Line.
# Maximum and Minimum sales in each product Line.

LOAD Product_Line,
max(Quantity) as MaxQuantity,
min(Quantity) as MinQuantity
FROM
[E:\Qlikview\data\product_sales.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
Group by Product_Line;

Click OK and Control+R to reload the data into QlikView document. Now follow the same steps as above in − Creating Sheet Objects to create a QlikView Table Box for displaying the result of the script as shown below.

Aggregate Functions in QlikView
Aggregate Functions in QlikView

So, this brings us to the end of blog. This Tecklearn ‘Aggregate Functions 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 "Aggregate Functions in QlikView"

Leave a Message

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