I've got data in the following format.
RoadAccidents (pk_accidentIdentifier)
with relationship 1..*
to Vehicles(fk_accidentIdentifier, ordinalNumber)
->
natural PK (compound) and surrogate, which is simply a rowID
).
ordinalumber
is just a number to iterate through vehicles that were involved in an accident.
--Sample Row
Accident001, 1, [list of attributes of a vehicle] -- 1st car involved in an inc
Accident001, 2, [list of attributes of a vehicle] -- 2nd car involved in an inc
Vehicles
with 1..*
relationship with table Casualties
which is connected in the same way as vehicles are with RoadAccidents
Meaning:
Casualties (Compound PK: (fk_vehicleID, casualtyOrdinalNumber)
--Sample Row:
Vehicle001, 1, [list of attributes of a casualty] -- 1st casualty involved in inc
Vehicle001, 2, [list of attributes of a casualty] -- 2st casualty involved in inc
So the relationship looks as follows.
RoadAccidents 1..* Vehicles 1..* Casualties
In addition table RoadAccidents
has already aggregated measures of numberOfVehiclesInvolved
and numberOfCasualties
.
There are 3(possibly more) approaches here for the fact tables
Two JOINS on
RoadAccident -> Vehicles -> Casualties
-> delete columns with aggregated numbers -> extract attributes to respective dimensions. Loose aggregated data -> have no meaningful measure -> create measures in SQL Server Data Tools.Have 3 fact tables.
FactRoadAccident
,FactVehiclesCollision
,FactCasaultiesInvInCollision
The problem I face: Fact tables should not be linked by foreign keys directly. Therefore, I can extract dimensions, such as.
DimRoadAccident *..1 DimRoadAccidentLocation
DimRoadAccident` *..1 DimWeatherConditions
Fact table would look as follows:
FactAccident
(fk_DimRoadAccidentPK, measure_numberOfVehicles, measure_numberOfCasualties
).
With this approach. Fact tables for Vehicles
and Casualties
would be just a surrogate FK with the id of a Vehicle
or Casualty
. The only measures would be row counts, meaning - number of Vehicles
or number of Casualties
.
- Keep only 1 fact table
FactAccident
(fk_DimRoadAccidentPK, measure_numberOfVehicles, measure_numberOfCasualties
).
Have dimensions linked DimRoadAccident 1..* DimVehicle 1..* DimCasualty
and have hierarchies created in Data Tools and possibly create some new semi-additive measures on dimensions.
What appraoch would you suggest?