TECHNOLOGIESTieInn Technologies

Testing reports and dashboards against the warehouse

ETL & Data Warehouse Testing · 7 questions

Short notes

Key idea

Test a report three ways: recompute it from the warehouse with its own definition (finds report logic and staleness), check refresh times against loads and manual changes, and reconcile it with the source using the business definition (finds load bugs). Then decide where each difference enters.

Syntax

WITH e AS (
  SELECT order_month AS month, COUNT(*) AS orders, ROUND(SUM(amount), 2) AS revenue
  FROM dw_orders WHERE status_group = 'fulfilled' GROUP BY 1)
SELECT r.month FROM rpt_monthly_sales r JOIN e USING (month)
WHERE r.revenue IS DISTINCT FROM e.revenue;

-- expected calendar
SELECT strftime(m, '%Y-%m')
FROM range(DATE '2024-01-01', DATE '2024-12-01', INTERVAL 1 MONTH) t(m);

Example

Shop dashboard: 2024 revenue ₹3,16,822.40 vs true ₹2,71,574.30 (17% high). June is stale (refreshed before a manual fix); January, February, March and September are wrong because of load defects; October is missing.

Traps

  • Testing only report vs warehouse.
  • No written definition.
  • Ignoring refresh times and manual fixes.
  • COUNT(*) for "orders"; skipped empty months; adding distinct counts.

Want the full lesson with step-by-step examples, a project and a certificate? ETL & Data Warehouse Testing course, ₹120 →

Questions

Open in Code Lab5 free questions
5 questions

    Testing reports and dashboards against the warehouse

  1. Question 1hard

    The report's definition: revenue = total amount of fulfilled rows in dw_orders that month (2024 only). Return the month of every row in rpt_monthly_sales whose revenue differs from that, rounded to 2 decimals.

    Tables
  2. Testing reports and dashboards against the warehouse

  3. Question 2medium

    June's report was refreshed after the June load, yet it disagrees with the warehouse. What's the most likely cause?

  4. Testing reports and dashboards against the warehouse

  5. Question 3medium

    How many 2024 months in the report differ from the source truth (delivered and shipped orders, source amounts)?

    WITH truth AS (
      SELECT strftime(order_date, '%Y-%m') AS month, COUNT(*) AS orders, ROUND(SUM(amount), 2) AS revenue
      FROM orders
      WHERE status IN ('delivered', 'shipped') AND order_date >= DATE '2024-01-01'
      GROUP BY 1
    )
    SELECT COUNT(*)
    FROM rpt_monthly_sales AS r
    FULL OUTER JOIN truth AS t ON t.month = r.month
    WHERE r.orders IS DISTINCT FROM t.orders OR r.revenue IS DISTINCT FROM t.revenue;
  6. Testing reports and dashboards against the warehouse

  7. Question 4medium

    For September, the report matches the warehouse, but the warehouse is lower than the source. Where should the bug go?

  8. Testing reports and dashboards against the warehouse

  9. Question 5easy

    A dashboard shows distinct customers per month and a yearly total. The yearly total is smaller than the sum of the months. Is that a bug?

2 more questions on this topic, with hints, and tests

Sign up free for 21 days of every question and test.