Define a KPI precisely and calculate it
Task
Turn "are customers coming back?" into a key performance indicator with a written definition, calculate it, and show how a different but reasonable definition changes the number.
Steps
- Write
lab/kpi/definition.md: the KPI namerepeat customer rate, its formula, its population, its period, and its owner. - Using the definition customers with two or more orders divided by customers with at least one order, in 2025, calculate it from
data/orders.csv. Recorddefinition A: Ninlab/kpi/values.txt, as a percentage to one decimal place. - Using the alternative definition customers with five or more orders divided by customers with at least one, record
definition B: N.
Verify
These checks run in a POSIX shell with Python 3: Terminal on macOS or Linux, and on Windows Git Bash (it comes with Git for Windows) or WSL. On Windows, python3 is often a Microsoft Store placeholder that prints “Python was not found”; run alias python3=py in Git Bash first.
grep -E '^definition (A|B): ' lab/kpi/values.txt
grep -ciE 'formula|population|period|owner' lab/kpi/definition.md
Definition A gives 98.3% and definition B 80.0%: both are a "repeat customer rate", from the same orders, 18 points apart. Which is right depends on what the business means by coming back, which is why the definition file matters more than either number.
This is an independent study companion for CompTIA Data+ DA0-002 and is not produced by or endorsed by CompTIA.