BigQuery Billing Exports: How to Analyze Your GCP Costs with SQL

Ben Makansi
April 23, 2026

The Billing Console gives you a visual breakdown of your GCP costs, but if you want to do serious analysis - filtering by label, comparing month-over-month trends, joining billing data with other datasets - you need to export your billing data to BigQuery. Once it is there, you can query it with SQL and build visualizations in Looker Studio. This pattern comes up on the Associate Cloud Engineer exam, and it is worth understanding both the setup and the intended use cases.

Why Export to BigQuery

The Billing Console is good for high-level cost overviews and quick lookups. But it has limits. You cannot write custom SQL against it. You cannot join it with other data. You cannot easily automate reports or share filtered views with stakeholders who do not have GCP console access.

BigQuery solves all of these problems. Once billing data is flowing into a BigQuery dataset, any SQL query becomes possible. You can answer questions like: which project spent the most in the last 30 days, which resource labels are missing from high-spend resources, how much did Cloud Run cost compared to the same period last month, and which team's workloads are growing fastest. These are the kinds of questions that the Billing Console cannot answer directly but that SQL makes straightforward.

How to Set Up Billing Export

Billing export is configured in the Billing Console, not in BigQuery or the Cloud Console. You navigate to Billing, then to Billing Export, and you configure the destination dataset - a BigQuery dataset in a project you specify. Google then writes billing data to that dataset on a regular schedule, usually once per day.

There are two export types to know. Standard usage cost export writes the core billing data: resource usage, costs, credits, and project metadata. Detailed usage cost export includes additional fields like resource-level labels and more granular usage breakdowns. For most analytical use cases, standard export is sufficient, but the detailed export is valuable when you need to understand costs at the individual resource level rather than the service level.

Once export is configured, you do not need to do anything else. Billing data flows into BigQuery automatically, and new data appears each day covering the previous day's usage.

Querying Billing Data with SQL

The billing export creates a table in your BigQuery dataset with a defined schema. The key columns include project.id for the project, service.description for the GCP service, sku.description for the specific resource type, cost for the charge amount, and usage_start_time and usage_end_time for the time period.

A basic query to find the top five projects by cost in the last 30 days looks like this:

SELECT
  project.id AS project,
  SUM(cost) AS total_cost
FROM
  `your-project.billing_dataset.gcp_billing_export_v1_XXXXXX`
WHERE
  DATE(usage_start_time) >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
GROUP BY
  project.id
ORDER BY
  total_cost DESC
LIMIT 5;

You can filter by service, add breakdowns by label, or aggregate by week to see spending trends over time. The full flexibility of BigQuery SQL is available on the billing export data.

Visualizing Billing Data in Looker Studio

Looker Studio, formerly called Data Studio, connects directly to BigQuery datasets and lets you build interactive dashboards without writing SQL. A common pattern is to export billing data to BigQuery, then build a Looker Studio dashboard that reads from that dataset and presents cost breakdowns as charts and tables that non-technical stakeholders can use.

The value of this pipeline - Billing export to BigQuery, then BigQuery to Looker Studio - is that it gives you automated cost reporting that updates daily without any manual work. Finance teams or budget owners can check a shared dashboard to see current spending without needing GCP console access.

What the Exam Tests

The Associate Cloud Engineer exam presents billing export in scenarios where a team needs flexible cost analysis beyond what the Billing Console provides. If a question describes a company that wants to write SQL queries against their billing data, the answer is to export billing data to BigQuery. If a question describes building a cost dashboard for a finance team, the pattern is BigQuery export plus Looker Studio.

One thing the exam tests is whether you know where billing export is configured - it is in the Billing Console, not in BigQuery or the Cloud Console. This trips people up because the destination is BigQuery but the configuration lives in billing settings.

Another angle is understanding what billing export captures versus what the Pricing Calculator does. Billing export captures actual usage and real costs after the fact. The Pricing Calculator estimates future costs based on planned configurations. The exam uses scenarios to make you pick the right tool for the context.

My Associate Cloud Engineer course covers billing exports alongside the Billing Console, Pricing Calculator, and budget alerts so you can distinguish between them on the Associate Cloud Engineer exam.

arrow