Sub topic 11
Exporting Data and Calculating Your Own Metrics
Assume you understand percentages, ratios, and the basic meaning of visitors, enrollments, revenue, refunds, and completion rate. You do not need advanced programming. An instructor or school account on Udemy or Teachable helps, but the workflow also works with sample data.
Why export data?
Platform dashboards are useful for quick checks, but they limit how you compare results. An export gives you rows of data that you can filter, combine, and recalculate.
Typical exports include:
- Sales or enrollment records
- Revenue and refund records
- Student progress or completion data
- Traffic or conversion reports
- Review and rating data
The exact menu names and available columns depend on your platform, account plan, and date range. Treat exported column names as platform-specific. For example, one report might use student_id, while another uses user_id.
A useful export should include a date or cohort field. A cohort is a group of students who share a meaningful starting condition, such as enrolling in the same month.
Build a metric table before calculating
Write down each metric’s numerator and denominator. This prevents a correct-looking percentage from answering the wrong question.
| Metric | Calculation | Question answered |
|---|---|---|
| Conversion rate | enrollments ÷ visitors | How often did visitors enroll? |
| Net revenue | gross revenue − refunds | How much revenue remained after refunds? |
| Completion rate | completed students ÷ chosen student group | How many students reached the completion threshold? |
| Revenue per visitor | net revenue ÷ visitors | What was the average net revenue associated with each visitor? |
Record the date range and filters beside every result. A monthly conversion rate cannot be compared fairly with a yearly rate unless the periods and traffic definitions match.
Calculate sales metrics
Suppose a report shows 1,200 visitors, 36 enrollments, 540.00 in revenue, and 45.00 in refunds. The following program calculates three values:
visitors = 1200
enrollments = 36
revenue = 540.00
refunds = 45.00
conversion_rate = enrollments / visitors
net_revenue = revenue - refunds
print(f"Conversion rate: {conversion_rate:.1%}")
print(f"Net revenue: {net_revenue:.2f}")
print(f"Net revenue per visitor: {net_revenue / visitors:.2f}")The output is a 3.0% conversion rate, 495.00 net revenue, and 0.41 net revenue per visitor. The last value is an average for the group. It does not mean that every visitor produced exactly 0.41.
Protect calculations from invalid denominators. If a report contains zero visitors, do not replace the denominator with one. Mark the rate as unavailable and investigate the report.
Calculate completion in two ways
Completion rate needs a clear denominator. The following export contains five enrolled students. Only two reached 100% progress, but four students started at least one lesson.
import csv
import io
raw = """student_id,progress_percent
s1,100
s2,45
s3,100
s4,10
s5,0
"""
rows = list(csv.DictReader(io.StringIO(raw)))
completed = sum(1 for row in rows if float(row["progress_percent"]) >= 100)
started = sum(1 for row in rows if float(row["progress_percent"]) > 0)
print(f"Completion rate (all enrolled): {completed / len(rows):.0%}")
print(f"Completion rate (started only): {completed / started:.0%}")The results are 40% of all enrolled students and 50% of students who started. Both calculations are valid, but they answer different questions. Report the denominator with the percentage.
Check and interpret your results
Before acting on a calculated metric:
- Confirm the date range, time zone, currency, and filters.
- Check whether refunds are recorded by sale date or refund date.
- Remove duplicate records only when you can identify why they are duplicates.
- Compare the result with another period or cohort.
- Keep the raw export unchanged and save calculations separately.
A small spreadsheet may be enough for one course. Python becomes useful when you repeat the same calculation across many exports or need consistent cohort comparisons.
Exercise
An export shows 800 visitors, 24 enrollments, 300.00 in gross revenue, and 30.00 in refunds. What are the conversion rate and net revenue?
Show answer
The conversion rate is 24 ÷ 800 = 3.0%. Net revenue is 300.00 − 30.00 = 270.00.