I want to convert a table structure with pivoted columns into a dimension table and fact table.
how to create a medication dimension table from the data with below structure with model enforcing star schema
I want to convert a table structure with pivoted columns into a dimension table and fact table.
how to create a medication dimension table from the data with below structure with model enforcing star schema
For some reason I cannot see the picture you uploaded to show data structure. I am assuming that you want to create a relationship between a medicine dim and a patient. If this is true then you need a bridge table between your medicine and your Fact table. The bridge table should have one row per patient ID and a specific medicine ID. That means if a patient is taking 4 medicine then there are 4 rows in the bridge table for same patient ID but different medicine ID. A patient ID should exist in the Fact table for a day so when Fact is join with the bridge table it shows all the medicine that patient is taking.