Real-Life Hospital Example
The CFO wants a single report where clicking one doctor’s name instantly filters appointments, treatments, and billing together. That kind of one-click filtering only works if the underlying data model is built correctly.
Practical Exercise (Hands-On)
In Model view, connect patient_id (patients to appointments and billing), doctor_id (doctors to appointments), appointment_id (appointments to treatments), and treatment_id (treatments to billing). Confirm every relationship is one-to-many with a single, dimension-to-fact filter direction.
Step-by-Step
⚠️ Caution: This lab was developed using Microsoft Power BI Desktop v2.155.756.0 (64-bit). If you are using a different version, you may notice minor differences in the menus, icons, or interface. The overall functionality and steps should remain largely the same.
- Click the Model view icon on the left sidebar of Power BI Desktop.
- Drag each table’s title bar so all five tables (patients, doctors, appointments, treatments, billing) are visible with dimension tables on top and fact tables below.
- Drag patient_id from patients onto patient_id in appointments to create a relationship; confirm Cardinality is One to Many and click OK.
- Drag doctor_id from doctors onto doctor_id in appointments (One to Many).
- Drag appointment_id from appointments onto appointment_id in treatments (One to Many).
- Drag treatment_id from treatments onto treatment_id in billing (One to Many).
- Drag patient_id from patients onto patient_id in billing (One to Many) so billing can also be filtered directly by patient.
- Double-click each relationship line to confirm Cardinality = One to many and Cross filter direction = Single, flowing from the dimension table to the fact table.
- Fix any relationship that Power BI auto-detected incorrectly (dotted line or wrong cardinality).
- Switch to Report view, add a Table visual with doctors[first_name] and appointments[appointment_id], and confirm the filtered count changes correctly when you click a doctor’s row.
- Save the file.
Expected Result
Model view shows five tables connected by five one-to-many relationship lines, all with single-direction filter arrows pointing from dimension tables to fact tables.
Mini Lab / Scenario Task
Create a standalone Date dimension table and connect it to appointment_date, bill_date, and treatment_date so a single date slicer can filter all three at once.