Data cleaning, analysis, and Power BI dashboard covering 106 African heads of state, tenure, turnover, and demographics since independence.
# African Heads of State Dashboard
A Power BI dashboard exploring 106 African heads of state — one historical (first post-independence) and one current leader per country across 54 nations — covering tenure length, how power has changed hands, and demographic patterns in African leadership since 1960.
## What This Project Does
Turns a messy, unstructured PDF table into a cleaned dataset and an interactive Power BI dashboard that answers questions like:
- How long do African leaders typically stay in power?
- How does power actually change hands — election, coup, death, or resignation?
- What does the gender and age profile of African leadership look like?
- Which leaders have the longest and shortest tenures on record?
See INSIGHTS.md for the full breakdown of questions answered and key findings.
## Process
1. **Extraction & Cleaning** — Source data came from a PDF with no consistent column delimiters. Parsed using regex anchors (dates, Yes/No tokens, a controlled vocabulary of regime types) into a clean, structured table.
2. **Data Prep (Power Query)** — Type correction, error handling (e.g. a `<1` month tenure value that Power BI initially flagged as an error), and null-value review.
3. **Modeling (DAX)** — Built measures for totals, averages, min/max tenure and age, and grouped categorical columns (Exit Category, Age Group) with custom sort logic.
4. **Visualization (Power BI)** — KPI cards, a sortable tenure-by-country bar chart, demographic donut charts, an age distribution column chart, slicers, and a styled dark theme.
## Tools
- Power BI Desktop (Power Query, DAX, Report visuals)
- Python (initial PDF text parsing)
## Files
| File | Description |
|---|---|
| `African_heads_of_state_dataset_clean.csv` | Cleaned dataset used in the dashboard |
| `African_Heads_of_State_dashboard.pbix` | Power BI dashboard file |
| `Insights.md` | Full write-up of questions answered and key findings |
| `African_Heads_of_State_dashboard.pdf` | Dashboard screenshot |
## …