Databases Reference
In-Depth Information
Dealing with facts without dimensions
Of course, when dimensions can exist without related facts, the inverse can also
be true. Let's look at how we can deal with facts that do not have any associated
dimension values.
As you may have noticed in the
Table Viewer
window, our current example data
model is a bit too tidy. There aren't any dimensionless facts. However, to illustrate
the new scenario, we've prepared a side example for which you will find the
corresponding datafiles in the
Airline Operations\Side examples\Chapter
8
folder. Make sure you have the
Flights.csv
and
Aircrafts.csv
files in the
specified folder. Then, follow these steps:
1.
Launch the QlikView program and create a new document. Save the
document into the
Airline Operations\Side examples\Chapter 8
folder as
Dimensionless Facts.qvw
.
2.
Next, go to the
Edit Script
window by pressing
Ctrl
+
E
, and load both the
Flights.csv
and the
Aircrafts.csv
files with the methods you've learned
until now.
3.
Explicitly assign a name to each table in the
Load
statement, using the
corresponding filename.
4.
When creating the
Load
statement for each table, you'll notice that there are
no shared fields between them, at least not explicitly. Therefore, we'll need to
rename the
AC_TYPEID
field in the
Aircrafts
table to
%Aircraft Type ID
so that an association is created between both tables through this field. To do
this, use the
as
keyword as follows:
AC_TYPEID as [%Aircraft Type ID],
5.
You should now have the following code:
Aircrafts:
LOAD AC_TYPEID as [%Aircraft Type ID],
[Aircraft Group],
Manufacturer,
[Aircraft Name],
[Aircraft Short Name]
FROM
Aircrafts.csv
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
Flights:
LOAD Year,
[Month (#)],