Reconcile Google Cloud Metered Usage Against Billed Line Items

Last updated: November 29, 2026

Quick Overview

Compare daily metered usage per project and SKU with billed quantities, and list every key that is unbilled, billed without usage, or billed with a quantity that differs by more than 0.1 percent.

Google
Data Manipulation (SQL/Python)
Data Engineer
Google
November 29, 2026
Data Engineer
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Compare daily metered usage per project and SKU with billed quantities, and list every key that is unbilled, billed without usage, or billed with a quantity that differs by more than 0.1 percent.

Billing correctness is a big deal for Google Cloud, and reconciliation jobs between metering and billing are standard data engineering work. The interviewer checks that you aggregate both sides to the same grain, use a FULL OUTER JOIN so mismatches on either side survive, and apply a tolerance instead of exact float equality.

What the Interviewer Expects
  • Aggregate both sources to the same key: project, SKU, usage date
  • Use FULL OUTER JOIN and COALESCE the keys
  • Classify missing on either side separately from quantity mismatches
  • Use a relative tolerance for floating point quantities
  • Discuss late-arriving usage and billing cutoffs
Key Topics to Cover
FULL OUTER JOIN
reconciliation
data quality
tolerance comparison
billing
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • Usage for a day can arrive up to 72 hours late. How do you avoid false alarms?
  • How would you express the mismatch in dollars to prioritize investigation?
  • How would you run this continuously and alert on it?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

metering_usage(project_id, sku_id, usage_date, usage_qty, ...) and billing_line_items(project_id, sku_id, usage_date, billed_qty, ...). Both can have several rows per key (regions, retries), so I ...

Approach

Aggregate each side to (project, SKU, date), then FULL OUTER JOIN on all three keys. A LEFT JOIN from usage would hide lines billed with no usage, and the reverse would hide unbilled usage; both are r...


Submit Your Answer
Markdown supported