Monday, May 21, 2012
Register

You are here  >  Articles

 



QlikConnect Articles

01

Hi Everyone,

This is the next article in our series of articles about dimensional modelling.

Using slowly changing dimensions (type 2) in your QlikView applications create the need for implementing surrogate keys in your fact tables. In the attached zip file one will find a QlikView example application that shows how to construct fact tables that have surrogate keys that support bot type 1 and type 2 slowly changing dimensions (SCD).

The attached example QlikView application is preserving the history of a customer dimension. You should extract the zip and adjust the settings of the variable vDataInput & vDataOutput on the main tab, in the script editor, to the location that you have extracted the files to. 

Steps to run and simulate this application:
  1. Change the variable vSCD in the srcipt edior;
  2. Execute the script.
The two objects in the tab "FactSales + Surrogate Keys" show what the impact is of the SCD type 2 for this fact table. The object on the left hand side shows that for customernumber 10009 & 10013 multiple surrogate keys have been added, which result in the partitioning of history.
Take a look at the comments throughout the script to determine what the different steps try to accomplish. If you have any question and/or comments please let us know.

Kind regards,
The QlikConnect team.



Comments

Oliver
# Oliver
Friday, January 13, 2012 2:37 PM
On script tab 'FactSales - SCD Type2'
there is an Intervalmatch, which refers to field DateInvoiced:

// Temp
Temp_%KeyCustomer3:
Intervalmatch (DateInvoiced)
NoConcatenate Load
ValidFrom,
ValidTill
Resident Temp_%KeyCustomer2;

The resultset of this Intervalmatch contains 4 rows.

**

Searching backwards in the script the next occurence of
the field DateInvoiced is here :

Temp_%KeyCustomer1:
NoConcatenate Load
CustomerNumber as vCustomerNumber,
InvoiceNumber as vInvoiceNumber,
DateInvoiced
Resident FactSales_Source
Where RowId = $(i);

But: this only has a resultset of a single row !

**

Based on that this cannot be the source of the field
in used in the Intervalmatch.

To verify this I renamed the field:

Temp_%KeyCustomer1:
NoConcatenate Load
CustomerNumber as vCustomerNumber,
InvoiceNumber as vInvoiceNumber,
//DateInvoiced
DateInvoiced as DateInvoicedOM
Resident FactSales_Source
Where RowId = $(i);

Result does not change !

**

Searching further backwards in the script for
the field name leads to :

FactSales_Source:
LOAD
CustomerNumber,
InvoiceNumber,
DateInvoiced,
DateInvoiced as Invoiced.Date,
AmountInvoice
FROM $(vDataInput)\FactSales_Source.qvd (qvd);

This resultset contains 9 rows with 4 distinct DateInvoiced - values.

Question: why does Qlikview not refer to the next occurence of
the field backwards ?
colby waldorf
# colby waldorf
Monday, February 20, 2012 10:10 AM
I completely agree that you all have completed the challenge quite well with the date dimension table which reports well for at least for a month..The example helped me a lot to design my own dimension table so effectively and easily.safe cookware
homer nelson
# homer nelson
Wednesday, February 22, 2012 9:39 AM
Hey this a great information , i was looking for this information all over the net bust was not able to find , but now i can complete my work , thanks to you.vacation homes in orlando florida for rent
Rozer Carter
# Rozer Carter
Wednesday, February 22, 2012 12:06 PM
In dimension modelling, surrogate keys selection is very challenging tasks. But you nicely explained here how to select and simulate the application. free reverse cell phone lookup

Post Comment

Only registered users may post comments.