cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User III
Super User III

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
Super User III
Super User III

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
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

January 2020 Community Highlights

January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Difinity Conference

Difinity Conference

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

Top Solution Authors
Top Kudoed Authors