Skip to main content
Skip to main content
Case Study · Personal project~8 min read

Medical Analysis: a Power BI Waiting-List Dashboard

A Power BI report over a public sample of hospital waiting-list snapshots from 2018 to early 2021: how big the list is now against a year ago, how it splits by case type, specialty, age and time waited, and how much the average moves when you switch to the median.

Nyiko Shabangu

Nyiko Shabangu

Software Engineer & Data Analyst •

Download the PBIX
  • Power BI
  • DAX
  • Power Query
Latest monthFeb 2021 snapshot
708K
Same month, prior yearFeb 2020 snapshot
625K
Year over year707,831 vs 625,259
~13%
Outpatient sliceof the donut, Average mode
72.43%

All four are read off the dashboard screenshots below. They describe the sample data only.

01 • Problem

The question

A waiting list is a stock, not a flow: each monthly snapshot records how many people are still waiting, and the next snapshot counts most of them again. A flat spreadsheet of those snapshots answers very little on its own. I wanted one screen that answers four questions:

  1. How many people are waiting in the latest snapshot, and how does that compare with the same month a year earlier?
  2. How does the list split by case type: outpatient, day case and inpatient?
  3. Who has waited longest, by age group and time band?
  4. Does the typical row look different if you use the median instead of the average?

It's a personal project on public sample data, built to practise data modelling and DAX end to end. It wasn't built for, or used by, an organisation.

02 • Data

The data

Everything on the two pages pictured below comes from one table, All_Data, loaded and typed in Power Query. Each row is the number of people waiting for one combination of snapshot date, case type, specialty, age group and time band.

Columns of the All_Data table and where the report uses them
ColumnWhat it holds
TotalHow many people are waiting in that row
Archive_DateThe snapshot date; the matrix shows month-end dates such as 31 October 2019
Case_TypeOutpatient, Day Case or Inpatient
Specialty_NameThe specialty, e.g. Vascular Surgery or Paediatric ENT
Age_ProfileAge group: 0-15, 16-64 or 65+
Time_BandsHow long people have waited, from 0-3 Months to 18+ Months

One property shapes every measure that follows: because the same people appear in snapshot after snapshot, adding Total up across dates double-counts them. The Detailed View’s grand total of 23,932,240 is the sum of every monthly snapshot in the slicer range, not a count of people. The headline cards therefore look at a single snapshot at a time.

03 • Model

The model

The model is small. These are the tables in the PBIX model view; the pages pictured here read from All_Data, and the Calculation Method table exists only to drive a button.

All_Data
The waiting-list table every visual reads from.
Calculation Method
A small parameter table with the values Average and Median. It drives the Average / Median buttons.
Mapping_Specialty
Groups specialties into a Specialty Group for the Drill Down page.
Inpatient, Outpatient
Two more tables in the model, named after their case types.

04 • DAX

The DAX

Three groups of measures do the work. The measure names are the ones in the PBIX; the bodies below are written out from the logic for readability, and the exact definitions are in the downloadable file.

Average and median, behind one toggle

Two plain statistics over Total. MEDIAN matters here because row sizes vary widely: in the 31 October 2019 snapshot one Vitro-Retinal Surgery row holds a single person, while one Vascular Surgery outpatient row (65+, 6-9 Months) holds 457, against an overall average of 54 per row in the donut.

Measures on All_Data
Average Wait List = AVERAGE ( All_Data[Total] )

Median Wait List = MEDIAN ( All_Data[Total] )

Rather than building every visual twice, a parameter table holds the two words Average and Median, shown as a button bar. One SWITCH measure reads the selection and returns the matching statistic, so the donut, the column chart and the specialty cards all change together.

Avg/Med Wait List
-- 'Calculation Method' is a parameter table with two rows: Average, Median.
-- (The column name in the PBIX ends with a space.)
Avg/Med Wait List =
SWITCH (
    SELECTEDVALUE ( 'Calculation Method'[Calc Method ], "Average" ),
    "Average", [Average Wait List],
    "Median",  [Median Wait List]
)

Latest month against the same month last year

The latest snapshot is the last date inside the slicer’s range. EDATE steps that date back twelve months, so the prior-year card follows the headline card without hard-coding a year.

Latest Month Wait List, PY Latest Month Wait List
Latest Month Wait List =
VAR LatestDate = MAX ( All_Data[Archive_Date] )
RETURN
    CALCULATE (
        SUM ( All_Data[Total] ),
        All_Data[Archive_Date] = LatestDate
    )

PY Latest Month Wait List =
VAR LatestDate = MAX ( All_Data[Archive_Date] )
RETURN
    CALCULATE (
        SUM ( All_Data[Total] ),
        All_Data[Archive_Date] = EDATE ( LatestDate, -12 )
    )

A title that says which statistic you’re looking at, and empty states

A Dynamic Title measure puts the selected method into the panel heading, which is why the summary screenshot reads “(Average)”. Two more measures, No Data and No Data right, use ISBLANK to show a message on the left and right of the page when the slicers filter everything out, instead of leaving empty cards.

05 • Visuals

The report pages

The two main pages are a Summary for the overview and a Detailed View for the numbers behind it. Select a screenshot to see it full size.

Summary

Summary page, Average mode, full date range. Cards: latest month (708K) and the same month a year earlier (625K). Donut: Avg/Med Wait List by case type. Columns: time band by age profile. Right: the measure per specialty. Bottom: monthly totals, with Outpatient on its own axis because it is roughly ten times larger.
  • Two cards: Latest Month Wait List (708K) and PY Latest Month Wait List (625K).
  • An Average / Median button bar bound to the Calculation Method table.
  • A donut of Avg/Med Wait List by case type, with the overall value in the middle.
  • A stacked column chart of time band by age profile.
  • A scrolling card list of Avg/Med Wait List per specialty.
  • Two monthly trend lines of Total: Day Case and Inpatient on the left, Outpatient on its own scale on the right.
  • Slicers for Archive_Date, Case_Type and Specialty_Name.

Detailed View

Detailed View. A matrix of the sum of Total by year, month, day, specialty, age profile and time band, split by case type, with all five slicers on the left. 31 October 2019 is expanded down to single specialties. The grand total adds every snapshot together, so it is not a head count.

The matrix is where the Summary’s numbers can be checked: February 2021 sums to 707,831 and February 2020 to 625,259, the two figures behind the 708K and 625K cards. The PBIX also has a third page, Drill Down, that charts the total by specialty group; it isn’t pictured here.

06 • Reading it

What the sample data shows

Read with the caveat that this is sample data, the dashboard surfaces a few patterns straight away:

  • The list grew year on year. The February 2021 snapshot is 707,831, about 13% above February 2020’s 625,259.
  • Outpatients dominate. The outpatient trend line climbs from about 502K at the start of 2018 to 627K by early 2021, while day case stays between roughly 46K and 62K and inpatient between 20K and 25K.
  • The donut needs care. In Average mode it shows Outpatient 80 (72.43%), Day Case 19 (16.93%) and Inpatient 12 (10.64%), 54 overall. Those are average people per row, so 72.43% is outpatient’s share of the three averages, not of patients. Summed over the same range, outpatients are 21,106,983 of 23,932,240, about 88%.
  • The longest waits sit in the largest rows. In Average mode, the 18+ Months column of the time-band chart has the highest average in every age group.

07 • Lessons

What I learned

  • Snapshot data needs snapshot measures. Each month repeats everyone still waiting, so summing Total across dates counts the same people again and again. The headline cards look at one snapshot at a time.

  • Put the median next to the average. Single rows range from one person to several hundred, so a few large rows can pull the average a long way. A toggle lets the viewer see both without a second copy of every visual.

  • Say exactly what a number is. The donut's percentages are shares of the averaged measure, not shares of patients. That is easy to misread, so the caption has to say it.

  • Plan for empty filters. A combination of slicers that matches nothing should show a clear message, not a blank card.

08 • Limitations

Limitations and what I'd do next

Being honest about what this is, and what I’d change looking at it again:

  • It's a personal project on public sample data. The figures describe that sample, not any real hospital's performance.
  • The Age_Profile legend shows "0-15" twice, in two colours. I'd clean that column in Power Query so each age group has one label.
  • The time bands are not in waiting order (18+ Months comes first). A sort-order column would fix the axis and the slicer.
  • I'd add a proper date table and use it for the prior-year measure, so month ends line up explicitly instead of relying on EDATE against the raw column.
  • The values on the per-specialty cards are hard to read against the background, and the Key Indicators heading has two typos. Both are quick fixes.
  • This page reports no performance figures. Next time I'd run Performance Analyzer and publish real timings rather than call it fast.

Open it yourself

Download the PBIX to see the measures and try the toggle in Power BI Desktop, or browse the rest of my projects.

Download the PBIX