Thursday 26 February 2015

Cross Table in QlikView

Cross Table in QlikView


 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 Jordan’s regular season statistics.
MichaelJordan_Stats
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
CrossTable_DifficultAgg
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
CrossTable_TableViewerNormal
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”
CrossTable_ExcelLoad

Click on “Enable Transformation step” to apply  CrossTable transformation
CrossTable_Transformation
Click on “CrossTable” under file parameters
CrossTable_Transformation2
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.
CrossTable_Transformation3
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_Transformation44
CrossTable Load script will look like the following. Number 2 in Crosstable syntax signifies the 2 Qualifier fields Season and Team.
CrossTable_Load
After the data load, If you see the Table viewer , it will look like
CrossTable_TableViewer
Fields will be loaded in the following fashion
AfterCrossTable_Load
Please watch my video for step-by-step method of loading Cross table

No comments:

Post a Comment