Sie sind auf Seite 1von 46

Q1 what are the roles and responsibilities of a QlikView developer?

it involves creation of dashboards which contains data model (Snowflake or Star schema)
as per requirement and wherein Data is extracted from various Sources systems like Sql
Server,Oracle,Excel file and data extracted from Source systems are stored in a QVD
form for faster retrieval of records and finally having graphical representation of Data in
the form of Charts,Table Box etc for better Analysis or forecast to End user prospective
and providing the section access to ensure that valid users are accessing/viewing the
dashboard.
Or
ETL
dashboard design
UAT of dashboards with business users
Support

Q2 What is the role of end to end implementations in the QlikView project?

Ok. I assume Qlikview is already implemented in the organization. Then the next steps
are:
Requirement gathering
Determining data sources
Creating requisite connection string to the database
Fetching the data in qlikview server and storing in QVD
Creating the data model
Creating the front end
Implementing section access as required
Creating jobs and scheduling for daily data load
Creating id, assigning the license and authorizing the dashboard
Support to the user
Enhancements/Changes as required

Q3What Is a QVD file?


QVD is a QlikView format and can only be written to and read by QlikView. A single QVD
file can store a single table and is created in the load script in a QVW file.
A QVD file consists of three parts:

XML header to describe the fields in the table, the layout of the subsequent
information and other meta-data.

Symbol tables in a byte stuffed format.

Actual table data in a bit-stuffed format.

Q4 what are KPIS & its need in Dashboard?

Suppose for Retail market, you have questions like, How much Sales happend last year..and What is
current state of Sales, are we meeting the Targets(which means count of sales), Which Store is
performing well as compared to others.
So these questions and their answers will become your KPI's for the application.

Please let us know, for which Domain(Finance, Retail etc) your application is for and then common
KPI's can be shared from fellow members.

Or
Key Performance Indicators are quantifiable measurements, agreed to beforehand, that reflect the
critical success factors of an organization. They will differ depending on the organization.

A business may have as one of its Key Performance Indicators the percentage of
its income that comes from return customers.

A school may focus its Key Performance Indicators on graduation rates of its
students.

A Customer Service Department may have as one of its Key Performance


Indicators, in line with overall company KPIs, percentage of customer calls answered in
the first minute.

A Key Performance Indicator for a social service organization might be number of


clients assisted during the year.
Whatever Key Performance Indicators are selected, they must reflect the organization's goals, they
must be key to its success,and they must be quantifiable (measurable). Key Performance
Indicators usually are long-term considerations. The definition of what they are and how they are
measured do not change often. The goals for a particular Key Performance Indicator may change
as the organization's goals change, or as it gets closer to achieving a goal.

Q5 what is your current project Architecture? not Qlikview architecture?


Generally Qlikview apps are developed using 3 architectures,

1 Tier or layer
2 Tier or layer
3 Tier or layer

In 1 Tier, all the Data Extraction scripts, Transformations and Presentation (charts) are done with in
same qlikview file.
In 2 Tier, all the Data Extraction is done and stored in QVD files in one Qlikview file and
Transformation and Presentation using QVD files generated in previous file are done with in another
Qlikview file.
In 3 Tier, Data Extraction is done and stored in QVD files in on Qlikview file, Transformation is done
using Qlikview files in another file, Presentation is done in another file using Binary load of
Transformed Qlikview file.

Q6 what is difference between qvd and qvw?

QVW: A qlikview file saved in binary format having the default expression QVW. Also called
QlikView file.qvw file contains tables, charts script etc.
QVD: a native Qlik View file format, A QVD file contains one data table, no layout and no
security. It is basically a binary CSV file optimized for fast loading.
Or

QVD is collection of data from the database, whereas QVW is the Qlikview application. But both
QVD and QVW are the file formats

QVD is Data warehouse and it covers data part whereas QVW is Design Application and it covers
Data Presentation.

Data Modeling in QlikView


is a very broad concept. QlikView is a wonderful tool and it gives you whole gamut of
functionalities to perfect your data model.
With this blog my intention is to give QlikView beginners an insight into QlikView
data modeling. I have received lot of emails from BI developers who say that they
are interested in QlikView but dont know from where to start. Some say that lot of
information is available which they can search but atleast they should know what
they searching on.
With this blog my objective is that without going into too much details, give these
developers an idea into QlikView data model,some important
keywords,functionalities and to drive them in exploring the awesome world of
QlikView.

1. Load statement in QlikView


In developing your application, first thing you have to do is to load data. QlikView
can extract data from disparate data sources such as Text
files,XLS,CSV,XML,QVDs,SAP,relational db,cloud and custom datasources.
To load data from Text files,CSV files and QVDs go to script editor(Cntl +E) and click
on Table files under Data from files.
You can load data from databases by clicking on connect and Select.
You can also copy your SQL query directly into QlikView script editor.
There are many different types of Load statements in QlikView. Search on Load
statements in QlikView
Loading excel file in QlikView
In QlikView you can connect to variety of data sources.
QlikView can connect to ODBC, OLEDB, XML data sources. You can also connect to
cloud data sources like SalesForce.com.

In this exercise i want to show you how to connect to an excel file in QlikView.

Steps:

Create new Qlikview document or use existing document

click on edit script on the tool bar menu

Inside the script editor choose option for Table files

Use Table files to load excel files.Use Database drop down to select ODBC and OLE
DB connections.

Browse to your file and open

Use file wizard if you want to make any changes to your file

Excel file. Use Labels drop down to include Embedded Labels to get the header
information. Use Tables drop down to load the specific tab in the excel file.

Give table name to your load script. Qlikview will use this table name to
identify your table

Load data

Verify by creating a sheet object

Right click and select New Sheet object/List box

Select OrderId field for your list box

Order ID list box. Data in List box shows that data is loaded successfully.

What is Preceding load


It allows you to define multiple transformations and calculations within one
load script which would otherwise will need to be created using separate load and
resident load statements.
It takes input from the previous Select statement.
Preceding Load is invoked by checking the preceding load while selecting the
tables.

Another Advantage of Preceding


Load is that it allows you to use
QlikView functions in the Load script.
Let us see how your script will look when you dont check the preceding Load while
selecting the table.

Preceding Load not checked

Load Statement without Preceding Load


Loading table without preceding load will not allow you to use QlikView functions.
Now let us check Preceding load and see how the load script changes and what
advantages it brings.

Load statement after checking preceding load check box


In this script you can see that preceding load takes the input from the previous
Select Statement. You can select all the columns in the Select statement but in Load
statement you can select the ones you need. Also observe Year and Month
Calculations. Preceding Load allows you to use QlikView functions like
Year,Month,ApplyMap etc.
There can be multiple preceding loads stacked one on the top of other.

Preceding load can be a useful tool to simplify your data transformations.

2. QVDs in QlikView
QlikView data files compress data from the database. It is 10-100 times faster to
read data from QVDs as compared to database. QVDs are best for large datasets and
to reduce load on the database. You can extract data from db and store it in a QVD
QVD can only be written or read from QlikView.
You can connect to the data source and export data in the table in a QVD.
Advantage of QVD
Once data is exported in the QVD you dont have to connect to database. Your data
will reside in QVD.
Reading from QVD is 10-100 times faster than reading from Data sources.
Consolidating data from multiple data sources and databases. Create multi-layer
QVDs to create a robust data model.
Incremental load can be implemented only by using QVDs
Storing Data in QVD

Table data can be stored in QVD by using Store into commands

QVD file will be stored in the specified location.

Reading from a QVD


You can read data from a QVD just like reading from a table.

QVDs can have calculations and expressions. You can create and read from multiple
QVDs and they will be associated similar to tables.
Once data is loaded in the QVDs you dont have to stay connected to data source
thus reducing load on the database servers. Only time you will connect to database
is when you need to refresh your QVD data with the updated data in the database.
You can schedule task on the QlikView server to reload your QVDs. To schedule tasks
on the server, you need to deploy your dashboards on the QlikView Server.

3. Association
In QlikView two or more tables are associated on common field names between the
tables. Two tables can be associated on a single column. If they are associated on
more than one field then Synthetic keys will be created. Look for how to associate
tables when there are no common field/names and also how to break association
between the tables

4. Synthetic keys
When you load multiple tables, then 2 or more tables can get associated based on
multiple field names. This will generate synthetic keys/synthetic tables. QlikView
recommends that synthetic keys should be removed as they are resource intensive.
Look for ways to resolve synthetic keys
Synthetic table and Synthetic keys gets created when there are more than one
common fields between the 2 or more tables.
QlikView associates tables based on the common field names in the tables and if
there is more than one common field then QlikView creates synthetic tables.
Synthetic keys are not beneficial in data model because they are resource intensive
and may slow down calculations. They also make data model hard to understand.
Synthetic keys should always be resolved.

Steps:

I have loaded 3 tables Products, Orders and OrderDetails

Load the table and analyze your data model in Table viewer and observe the
joins

ProductID and UnitPrice and common in Products and OrderDetails table and
therefore created synthetic keys.

Make sure that Table associates only on the required fields. since Products and
OrderDetails table are linked on ProductID, we can remove Unitprice from the
table. You can do so either by commenting Unitprice or renaming it. Let us
rename Unitprice in Products table by using AS

Now load the tables again and check the Table viewer. Observe that Synthetic
table/Key is removed and Products and OrderDetails are linked on ProductID.

5. Loops
When keys between three tables in a data model form a circle,circular references are
created.Avoid circular reference or loop by using loosely coupled tables or by
aliasing one of the columns
There are two Swedish car brands, Volvo and SAAB. Or, at least, there used to be... SAAB was made
in Trollhttan and Volvo was and still is made in Gothenburg.

Two fictive friends Albert and Herbert live in Trollhttan and Gothenburg, respectively. Albert drives
a Volvo and Herbert drives a SAAB.

If the above information is stored in a tabular form, you get the following three tables:

Logically, these tables form a circular reference: The first two tables are linked through City; the next
two through Person; the last and the first through Car.

Further, the data forms an anomaly: Volvo implies Gothenburg; Gothenburg implies Herbert; and
Herbert implies SAAB. Hence, Volvo implies SAAB which doesnt make sense. This means that you
have ambiguous results from the logical inference - different results depending on whether you
evaluate clockwise or counterclockwise.

If you load these tables into QlikView, the circular reference will be identified and you will get the
following data model:

To avoid ambiguous results, QlikView marks one of the tables as loosely coupled, which means that
the logical inference cannot propagate through this table. In the document properties you can decide
which table to use as the loosely coupled table. You will get different results from the logical inference
depending on which you choose.

So what did I do wrong? Why did I get a circular reference?

It is not always obvious why they occur, but when I encounter circular references I always look for
fields that are used in several different roles at the same time. One obvious example is if you have a
table listing external organizations and this table is used in several roles: as Customers, as Suppliers
and as Shippers. If you load the table only once and link to all three foreign keys, you will most likely
get a circular reference. You need to break the circular reference and the solution is of course to load
the table several times, once for each role.

In the above data model you have a similar case. You can think of Car as Car produced in the city or
Car that our friend drives. And you can think of City as City where car is produced or City where
our friend lives. Again, you should break the circular reference by loading a table twice. One possible
solution is the following:

In real life circular references are not as obvious as this one. I once encountered a data model with
many tables where I at first could not figure out what to do, but after some analyzing, the problem
boiled down to the interaction between three fields: Customers, Machines and Devices. A customer
had bought one or several machines; a device could be connected to some of the machine types
but not to all; and a customer had bought some devices. Hence, the device field could have two roles:
Devices that the customer actually had bought; and devices that would fit the machine that the
customer had bought, i.e. devices that the customer potentially could buy. Two roles. The solution was
to load the device table twice using different names.

Bottom line: Avoid circular references. But you probably already knew that

6. Reduce number of tables


Always try to reduce the number of tables and joins in your data model. Use
Mapping tables and ApplyMap function to clean up your data model as necessary

In Qlikview it is always advisable to minimize the number of tables in the data model.
Mapping Tables are used in QlikView to clean up the data model.
Tables with just 2 columns can be removed and columns of that table can be mapped
to another table.
Mapping tables are stored in a separate area in memory and used only as mapping
tables during script execution. After script execution they will be automatically
dropped.

7. Inline tables
To create smaller reference tables,create Inline tables.

8. Joins
In QlikView result of a join between two tables is a single table. Joins works in a
similar fashion as SQL joins with exception being KEEP. Left Keep and Right Keep can
be very useful

Explaining Joins
Those familier with manipulating data in SQL or other BI technologies should have no
problem understanding the different types of joins available in QlikView. But those who aren't
sometimes need a little explanation and it's a topic that I've fond myself explaining often
when training people.
The four primary logical join types, LEFT, RIGHT, INNER and OUTER are supported in
QlikView. Let's consider the following eample tables and what the output for each will be:
Field2

Field1
A

Field2

Field3

As you can see, both tables contain a column called Field2 for which some, but not all, of the
values have a matching entry in the other table. The syntax for performing a join in QlikView
is relatively simple as follows:
MyTable:
LOAD
Field1,
Field2
FROM myqvd1.qvd (qvd);
LEFT JOIN (MyTable)
LOAD
Field2,
Field3
FROM myqvd2.qvd (qvd);

It is important to note that QlikView links records based on matching field names in the two
tables being joined. In the example above, both tables contain a field called Field2 and thus
QlikView will look for matches across these fields.

Also worth noting is the the table name defined in curved brackets. This defines the
previously loaded table which the following table should be joined to. It is not mandetory but
it is considered best practice to always specify a table to join to inorder to avoid confusion or
mistakes. Without it, QlikView joins the table of data to the previously loaded table.

LEFT JOIN
In a LEFT join, all the records from the first table are kept, and only those records from the
second table that match a record in the first table are kept. Using the above example tables,
the output would be as follows:
Field2

Field1

Field3

You will notice that there is a blank entry in Field3. This is because no matching record exists
in the second table. You will also notice that the record in the second table for which there is
no match in the first table has not been included.

RIGHT JOIN
In a RIGHT join, all the records from the second table are kept, and only those records from
the first table that match a record in the second table are kept. Using the above example
tables, the output would be as follows:
Field2

Field1

Field3

You will notice that there is a blank entry in Field1. This is because no matching record exists
in the first table. You will also notice that the record in the first table for which there is no
match in the second table has not been included.

INNER JOIN
In an INNER join, only records with a match across both tables will be kept. Using the above
example tables, the output would be as follows:
Field2

Field1

Field3

You will notice that there are no blank entries. Records from either table for which a match
was not found have not been included.

OUTER JOIN
In an OUTER join, All records will be kept and where possible, records will be matched.
Using the above example tables, the output would be as follows:
Field2

Field1

Field3

You will notice that there are blank entries in both Field1 and Field3. This is because a
matching record was not found in the other table.

When Joins Go Wrong


The most common and easily made mistake when joining tables is not having at least one
field named the same in both tables. When this occurs, QlikView can't make any matches
within the data and so outputs all possible combinations of the records in both tables. This is
known as the cartesian product. If we take the above example but rename Field2 in the
second table by mistake so it no longer matches the first table like this:
Field2

Field1
A

Field22

Field3

When performing any of the join types on these two tables, QlikView would create the
following result:
Field2

Field1

Field22

Field3

The produced table contains all possible combinations and therefor the number of rows it
contains will be the number of records in the two tables multiplied together. In this example 3
x 3 = 9 records. This isn't the end of the world when data sizes are relatively small, but when
mistakes are made joining tables containing millions of records, the resulting table can take
a very long time to calculate and be so large that it uses up all the physical RAM and result
in the machine becoming unresponsive. Anyone working with QlikView on large datasets for
very long will have learnt this lesson the hard way. I remember making a mistake whilst
joinging a billion record table to itself and had to explain red faced to the customer's IT
department why I needed them to restart the non-responsive server as it tried to calculate
the result.
A cartesian product isn't always the result of a mistake though and can also be performed on
purpose in advanced data transformations. For example, if I have a calendar table with a
record for each day but what I really need is to expand it to have a record for each 8 hour
shift in each day, there is more than one way to approach the problem. I could load the
calendar into a temp table and then concatenate it 3 times into a resulting table denoting the
shift each time, or I could create a Shifts table containing a record for each shift and join it to
the calendar table providing no matching field and thus purposfully causing a cartesian
product.

Using Joins in QlikView


by Josh Abbott on May 23, 2012 in QlikView

SQL developers share the common experience of joining related tables in order to
retrieve data sets. The same holds true when working with data in QlikView. For those
with a SQL background, the syntax for joins in QlikView are slightly different and can be
a bit disconcerting when they are used. Its easy to scratch your head and wonder why
all joins in all languages are not created exactly the same. In this article, I will lead you
through the different types of joins and how to use these joins in a QlikView application.
First, you need to understand how tables are joined in QlikView. In SQL, you specify the
related columns from each table to be joined. For instance, if you join a Region table to
a RegionContact table, you write something similar to the following:
select
*

from
Region
join
RegionContact
on Region.RegionID = RegionContact.RegionID
In this instance, you join the Region table to the RegionContact table on the RegionID
column that exists in both tables. In QlikView, a join is done based on fields that have
the same name. Column names are not actually specified; if they have the same name,
they join, if not, they are not joined. To join, all that is needed is the type of join.
First, there is the inner join. The definition of an inner join is that it returns all rows that
match based on like fields in both tables. Here is an example:
Region:
LOAD * INLINE [
RegionID, RegionName
1,East
2,West
3,North
4,South
];
INNER JOIN (Region)
RegionContact:
LOAD * INLINE [
RegionID, ContactName
1,John
2,Roger
5,Linda
];
In this situation, you have a Region table with regions 1 4. The RegionContact table
has only regions 1, 2, and 5. These tables join because the column RegionID exists in
both tables, but will only return the two matching records, 1 and 2:

Next is the left join. By definition, a left join returns all rows from the first table, and only
matching rows from the second table. Here is an example:
Region:
LOAD * INLINE [
RegionID, RegionName
1,East
2,West
3,North
4,South
];
LEFT JOIN (Region)
RegionContact:
LOAD * INLINE [
RegionID, ContactName
1,John
2,Roger
5,Linda
];
The only difference between the left and inner join is the use of the words Inner and
Left. In this example, table 1 (Region) has Regions 1 4. Table 2 (RegionContact) has
Regions 1, 2, and 5. Since 5 does not exist in Region, it is eliminated from the resulting
data set. The Contact Name for regions that dont exist in RegionContact will return a
null value.

Opposite the left join, is the right join. By definition, the right join returns all values from
the second table, and only matching values from the first table:
Region:
LOAD * INLINE [
RegionID, RegionName
1,East
2,West

3,North
4,South
];
RIGHT JOIN (Region)
RegionContact:
LOAD * INLINE [
RegionID, ContactName
1,John
2,Roger
5,Linda
];
Since only Regions 1, 2, and 5 exist in the second table, these are the only values that
will be brought back. Since 5 does not exist in the first table, the RegionName will return
a null value.

The next join to look at is the outer join. The outer join returns all rows from the first
table and all rows from the second table:
Region:
LOAD * INLINE [
RegionID, RegionName
1,East
2,West
3,North
4,South
];
OUTER JOIN (Region)
RegionContact:
LOAD * INLINE [
RegionID, ContactName
1,John
2,Roger
5,Linda

];
This returns 5 records, records 3 and 4 will have no ContactName, and record 5 will
have no RegionName.

For any of these joins, if there are no like fields to join on, they create one record for
each row in each table. So if table 1 has 10 rows, and table 2 has 10 rows, and a join is
performed where there is no like field name (joining field), 100 records is be returned, 1
for each combination of every value from table 1 and table 2.
The last type of join in QlikView can give developers the most trouble. Concatenate is a
type of join that is similar to a SQL UNION statement. Concatenate allows rows to be
placed on top of each other or merged together into one table. Lets say we have two
tables, our Region table, and another table called OldRegion:
Region:
LOAD * INLINE [
RegionID, RegionName
1,East
2,West
3,North
4,South
];
CONCATENATE (Region) OldRegion:
LOAD * INLINE [
RegionID, RegionName
5, SouthEast
6, NorthWest
];
In this example, you return a concatenation of these two tables:

Like-named columns are placed on top of each other. Since both column names match,
you see values for all fields. Where developers run into problems is in understanding
that QlikView concatenates tables that have exactly the same number of columns with
exactly the same names by default (order does not matter). Consider a developer that
wishes to return two tables, Region and OldRegion. They run the script above without
the Concatenate:
Region:
LOAD * INLINE [
RegionID, RegionName
1,East
2,West
3,North
4,South
];
OldRegion:
LOAD * INLINE [
RegionID, RegionName
5, SouthEast
6, NorthWest
];

The developer achieves the same result as above: Only 1 table is returned. If you do not
wish to create one table, the keyword NOCONCATENATE must be specified.
Joins are very useful in QlikView as they you to simplify your data model by combining
fields from like tables. Its helpful to know your joins, and learn how to use them while
developing your QlikView script.

9. Organize your Script


Organize your scripts by creating Tabs for related tables or logic. Use comments to
make your scripts logic easier to understand. All the tables should be
named.Remember QlikView script execution is from left to right and top to bottom.
Any referenced tables should be created before being referenced.

10. Master calendar


No dashboard is ever complete without Time dimension. Create Master calendar if
you dont have continous dates in your fact table. Peek function is very useful while
creating a calendar.

Master Calendar in QlikView


4 June, 2013 Chandraish Sinha

In any Dashboard,Time is an important factor. Users will always be interested in


viewing the data by time period and also will be interested in performing comparitive
analysis between 2 time periods.
In a data warehouse, a Time dimension table is usually present, which joins to the
fact table and produces results.In some situations, time dimension is not present but
a date field is present in the fact table.In such scenarios, it is a best practice to

create Master calendar by taking the date field in the fact table. This Master table
will contain all the combinations of date and time and will join to the fact table.
In this blog i will discuss how to create a Master calendar based on date field in the
fact table.
In my previous blogs, i have loaded SalesOrderHeader table. This table contains
OrderDate field.
You can always create Time values by applying date time functions on the OrderDate
column
Year(OrderDate) As Order_Year
Month(OrderDate) As Order_Month
This will give you Year and Month values but it will give you only the values which are
present in the database. If say, for example, there were no Orders in March then this
method will not show the March month in the list box and date will not be continous.
To resolve this problem, we will create Master Calendar.

Steps:
1. Create or set the value of Min date based of the OrderDate in the SalesOrderTable.
This can be done either by hardcoding the start date or by taking the first value of
the OrderDate by using Peek()
Peek() will give the value of the OrderDate in the first record
Let varMinDate = Num(Peek(OrderDate,0,OrderHeader));
2. Create or set the value of Max date
Peek() will give the value of the OrderDate in the last record
Let varMaxDate = Num(Peek(OrderDate,-1,OrderHeader));
3. Generate the rows in the calendar table by using Autogenerate. Autogenerate in
QlikView is used to generate rows automatically.
TempCalendar:
Load
date($(varMinDate) + rowno() 1) As TempDate
Autogenerate
$(varMaxDate) $(varMinDate) + 1;

4. Create Master Calendar


MasterCalendar:
Load
TempDate As OrderDate,
Week(TempDate) As Week,
Year(TempDate) As Year,
Month(TempDate) As Month
resident TempCalendar;

QlikView application consists of 2 parts Visualizations and Data model. Your


visualization will display the underlying data.Therefore creating a robust Data model
is key to any successful application.

1. Concatenate in QlikView
In QlikView, if the number of fields and field names of two or more tables are same
then the tables are Concatenated into one table. There are many flavors in
Concatenate like Automatic Concatenate,Forced Concatenate and No Concatenate.
Concatenate tables can be useful in resolving synthetic keys.

Concatenate and NoConcatenate in QlikView Part 1


15 October, 2013 Chandraish Sinha

In QlikView, if the number of fields and field names of two or more tables are same
then the tables are Concatenated into one table.
It usually happens when you are loading tables from different datasources and dont
realize that field names and field numbers in different tables are same. After the

dataload you expect to see two separate tables in table viewer but instead see only
one.
Concatenate happens in different ways.
1. Automatic Concatenation
2. Forced Concatenation
3. No Concatenation

In this Part 1 i will cover Automatic


Concatenation
Automatic Concatenation
As stated above,when field names and field numbers of 2 or more tables is same
then the tables are concatenated into one table. Order of the columns in tables does
not matter. Also The Sum of records in the resulting table is the Sum of the number
of records in Table 1 and Table 2.
Let us load first table and see it in the table viewer

As you can see that this table has following 4 rows.

Let us now load 2 tables, with same name and number of columns.
Table Cust_1 has 4 rows and table Cust_2 has 3 rows. Order of columns are different.
Observe Table viewer and number of rows in the resulting table.

As you can see the number of rows in the resulting table is 7 rows. The Sum of
records in the resulting table is the Sum of the number of records in Table 1 and
Table 2.

In this Part 2, you will see Forced Concatenation and how to prevent Concatenation
i.e. NoConcatenation.
Forced Concatenation
If two or more tables do not have exactly same name and number of fields, it is still
possible to concatenate them by using
concatenate keyword before the load statement.
Let us load 2 tables with different sets of fields

Concatenation do not occur as Tables have different set of fields.


Now to force concatenation use Concatenate key word before the load of second
table

Observe that the tables are concatenated and numbers of rows is 7 i.e. Sum of rows
in Table1 and Table2.

Preventing Concatenation
If the field names and number is same in 2 or more tables them QlikView performs
an automatic concatenation but it is possible to prevent this automatic
concatenation by using NoConcatenate
Let us load the same tables as in Part1 i.e. Table Cust_1 and Cust_2. These tables
have same set of fields so they should get concatenated but this time load them by
using NoConcatenate

Table viewer shows 2 tables. Automatic concatenation was prevented by using


NoConcatenate.

Note that 2 tables are created but since they have more than one field in common, it
created a synthetic table. Resolving synthetic table and keys is a different topic and
you can get details on it from my earlier blog on Resolving synthetic keys.
For this excercise we wanted to see that using NoConcatenate we can avoid
automatic concatenation.
Summary :
1. Automatic concatenation occurs when the name and number of fields are same in
2 or more tables
2. Forced concatenation is done by using Concatenate keyword. It will concatenate
tables even if they do not have same set of fields
3. No Concatenate can be used to prevent automatic concatenation, even if tables
have same set of fields.
Tip : Concatenate is very helpful when you have to include 2 or more Fact tables in
your data model. These Fact tables should be of same granularity

2. Link Table in QlikView


Whenever you will hear about Concatenate, you will hear about Link table as well.
Link tables are also used when you have to add multiple fact tables in your data
model. These fact tables may be of different granularity and associated to same or
different dimension tables.Link table is a means to resolve synthetic keys. Link table
contains the common fields from multiple tables.

The Magic of link Table


In Data warehousing world, many a times you come across a situation where you
have to handle multiple Fact tables.
Star schema usually have a single Fact in the center and dimensions surrounding it
but some times you have a situation where you have more than one Fact table.
If you want to learn more about Facts and Star schema, please visit my earlier
blog http://www.learnallbi.com/dimension-and-fact/.
In this blog i will discuss about how to handle multiple fact tables in QlikView data
modeling.

Link table vs Concatenate


When you have multiple Fact tables in QlikView, it can be handled in 2 ways, by
using concatenate or by using Link tables. If the granularity and columns in the fact
tables are same then you can use Concatenate which will merge the tables into one
and resulting table will have the sum of rows of the two tables.
Use Link table, when the granularity of the facts tables are different and when they
are joined to different dimensions.
Concatenate and Link Tables are ways to resolve synthetic keys which formulate due
to the presence of multiple fact tables.

Link Table example


To explain the concept of Link table, I will load few fact tables and dimension tables.

if you load these tables, you will get synthetic fields in your data model. These
synthetic keys are formed since we have multiple Fact Tables and these fact tables
are sharing the same dimensions.Since these fact tables are joining to the same dim
tables they have duplicate/common fields.

Resolving Synthetic Keys using Link table


To resolve these synthetic keys we will :
Create a composite key. Link table can connect to the original fact tables using this
composite Key
Load all the common fields in one table called Link table
Drop these fields from the original tables.
Lets see these steps in screen shots below:

Creating composite keys

Creating Link table. Loading common fields from the original Fact tables.

Drop fields as we no longer need these fields.


After following the above steps and loading the data , you will get the following data
model. As you will notice, Link table is in the center. Link table contains all the
common fields and Link table is linked to other fact tables using the Key field.

Link Table is a very useful way to resolve synthetic keys when multiple fact tables are
present in the data model.

You should always load Distinct records while creating Link table. Also if the Key
field/composite field contains several individual fields then it is good to create Key
field using Auto number ( ) function like the one below
AutoNumber(YEAR_MONTH&|&CUSTOMER_KEY&|&HIERARCHY_KEY&|&LOGO_KEY
) As [%Key field]

3. Partial Load
Partial load is used when you want to load just one table in your data model/script
without reloading all the other tables. For example, you are in development phase
and your script contain 10 tables but you want to just reload one table since data in
table changed or the structure of this table has changed. If you perform normal load
then all 10 tables will be loaded that may take time. But with Partial load you can
just load one table.
To perform partial load you have to prefix your load statement with ADD or REPLACE
keywords.
Prefixing your load statement with ADD will append the new records. Prefixing your
load statement with REPLACE will drop the exisitng table and create a new table.
Tip: To perform Partial load, use File menu ->Partial load or Ctrl + Shift + R. Partial
load functionality is useful in development. Remove ADD or REPLACE when your
development is completed and you are migrating your application on the server.

4. Cross table in QlikView


Load statement is prefixed with CrossTable when you want to load a CrossTable. A
CrossTable is a table structure with Orthogonal list of headers. If a CrossTable is
loaded as a normal table then each of the column will be loaded separately as an
individual dimension.Performing aggregation on such a table will be difficult. Also it
will consume lot of memory. CrossTable prefix will transform columns into rows.
Cross Table is a table with Orthogonal list of headers. Orthogonal simply means at
right angles.
We come across cross tables everywhere in our daily lives.

Michael Jordan is the greatest basketball player of our times. I am a big fan of
Michael Jordan. To explain the concept of Cross table, i will take a sample of Michael
Jordans regular season statistics.

Michael Jordan Stats Source espn.go.com


This is a cross table because it contains 3 Orthogonal lists of headers Season,Team
and Categories.
if this is loaded in QlikView in a normal fashion, it will create separate list for each of
the columns. After the data load, it will look like

If the Cross table is very large with huge number of Orthogonal headers then it will
make the application very heavy because each of the column in the cross table will
be loaded separately.
If you view this table in the table viewer, it will look like

In QlikView you have to load a CrossTable by using CrossTable transformation


(prefix load statement with CrossTable syntax). It will then create one column
for Season,One for Team ,One for each of the Category and One for Data.
Loading Data by using CrossTable transformation
To load a crosstable, start with similar steps as loading Table file/excel file, click on
Table files

Click on Enable Transformation step to apply CrossTable transformation

Click on CrossTable under file parameters

Select the Qualifier field/s, Attribute field and Data field.


Qualifier fields are the columns to the left. You can decide which columns you want
to treat as qualifiers.

Loaded Crosstable will look like the following , which is one column for Season,One
for Team ,One for each of the Category and One for Data.

CrossTable Load script will look like the following. Number 2 in Crosstable syntax
signifies the 2 Qualifier fields Season and Team.

After the data load, If you see the Table viewer , it will look like

Fields will be loaded in the following fashion

5. Section access
Security is an important part of an application. Section access is used to provide data
level security to your application. By using Section access you can limit what data

authorized users can see. Section access is defined in script editor as a hidden script.
The access control data can be managed through Text files,databases or Inline
tables.

6. Binary Load
When we talk about Section access , we talk about Binary Load as well. Binary load is
used when you want to load the script part of another qvw file. You can have only
one Binary load in a qvw and it has to be the very first statement in your script.You
can only load one qvw in your document. It loads just the script part, visualization is
never loaded. It is useful when applying security using Section Access. You can
develop security guidelines in a separate QVW and then add that QVW using Binary
Load in all the other documents.

7. Interval Match
Interval match function is used with Load statement for linking the discrete values to
one or more numeric intervals.It can be used for example, in scenarios where you
have 2 tables one table containing Shift intervals like Start and End and another
tables containing just the Time. You can use Interval Match function to link these 2
tables and find out in which Time interval these Start/End shifts occur.
Interval Match extended syntax is used to handle the Slowly changing dimensions.
Interval Match and Slowly changing dimension
In these blogs i have made an attempt to cover all the basic building blocks of
QlikView data modeling. Continue exploring and learning the awesome world of
QlikView.