Forum Discussion

PoetryinMotion1's avatar
PoetryinMotion1
Regular Visitor
3 years ago
Solved

Figuring out a data model

Hi all,

Struggling with this one, although I might be overthinking it.
My data model has three tables listed below. I need to create a matrix with the following columns: 

a. Stage name

     a1. Sub-stage

b. Expected expense

c. Spent.

 

How can I ensure that all Stage Names are used, and when a row from the Fact Table such as the ones that have Stage 500 don't have a matching value in the Expected Expense table they will still show up in the matrix and vice versa? I'm thinking it would need to be a union of the Stage in tables 1 and 3 and duplicates removed.

 

Any ideas would be welcome.

 

1. Expected Expense:          

Project ID Stage    Sub StageExpected ExpenseStage Name
12345610016010000Phase 1
12345610018020000Phase 1
12345620021030000Phase 2
12345620023040000Phase 2
12345630031050000Phase 3
12345630032060000Phase 3
12345640041070000Phase 4
12345640042080000Phase 4

 

2. Stage and Sub-Stage master list:

 

StageSub Stage
100160
100180
200210
200230
300310
300320
400410
400420
500510
SUV100SUV110
SUV200SUV220

 

3. Fact Table:

SpentStageSub StageProject ID
3516100160123456
574100160123456
4108100160123456
539100180123456
122200230123456
1420200230123456
242200230123456
2652300310123456
2953300310123456
4015400410123456
4742400410123456
2535500510123456
4854500510123456
2656500510123456