Link tables
There are times when it is necessary to have two or more fact tables that have some common dimensions, but they are too big or complex to merge or join in a simple way.
Background
Let's take a typical example of a daily transaction table and a monthly budget/forecast table. They could have common fields that need to be shared as dimensions, such as the Period
, Product Type
, or Region
, but having them in two separate tables would not work.
How to do it
Taking this simple example, we want to be able to connect these tables together so that we can not only select Periods
, Product Type
and/or Region
(Product Type
and Region
are held in both tables) but also be able to find the forecast figure for the transactions.
Using the following script to read these two tables, you will notice that both alias the Product Type
and Region
fields so that they don't join, and the script also adds a unique ID field based on the record number (the Date field name is already different in both...