cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
EvilDevil Visitor
Visitor

How to transform m to n relations and time series to star schema data

Hello clever people

I have a problem with transforming time series data into a star schema. What is the best solution? The fact table will consist of master data on PatientID. I want to be able to - on any given date to tell where the patient is hospitalized and which drug(s) they were prescripted.

My test data looks like this:

Table 1: Hospitalization    Table 2: PrescriptionDrug   
PatientIDHospitalCityHospitalizationStartDateHospitalizationEndDate PatientIDPrescriptionDrugPrescriptionStartDatePrescriptionEndDate

1

Copenhagen12-aug-1715-aug-17 1Vicodin01-feb-1715-sep-17
1Stockholm27-sep-1714-dec-17 1Levoxyl10-maj-1731-dec-99
1

Berlin

09-jan-1816-feb-18 2Lipitor10-okt-1612-aug-19
2Stockholm22-apr-1823-apr-18 2Vicodin10-okt-1612-aug-19
2Berlin31-aug-1914-sep-19 2Amoxil10-okt-1625-nov-18
3Copenhagen02-apr-1816-maj-18 2Delasone03-apr-1715-sep-17
3Oslo05-nov-1819-dec-18 2Zestril19-aug-1931-dec-99
3Berlin03-sep-1909-sep-19 3Amoxil03-sep-1920-okt-19

 

1 ACCEPTED SOLUTION

Accepted Solutions
sturlaws New Contributor
New Contributor

Re: How to transform m to n relations and time series to star schema data

Hi @EvilDevil 

here is how I would have done it: sample

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

View solution in original post

1 REPLY 1
sturlaws New Contributor
New Contributor

Re: How to transform m to n relations and time series to star schema data

Hi @EvilDevil 

here is how I would have done it: sample

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

View solution in original post

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (1,045)