Skip to main content
BigQuery is Google’s fully managed, serverless data warehouse where your SourceMedium data lives. It handles large-scale analysis and complex data types, and controls access through IAM. This guide provides practical queries you can run immediately against the standard SourceMedium modeled datasets in your BigQuery project.
Recommended starting point: Most customer analytics should start in the sm_transformed_v2 dataset within your Google Cloud project.
Some workspaces also have access to raw source datasets or platform-native exports in BigQuery. Those datasets are organization-specific and are not the canonical SourceMedium modeled layer unless SourceMedium has documented them for your workspace.
New to BigQuery? Start with Google’s How to Get Started with BigQuery video for a quick introduction.

Finding tables and schemas

Use BigQuery Explorer to find your project, then start with the sm_transformed_v2 dataset for modeled SourceMedium analytics tables. For SourceMedium-modeled data:
  • Table docs live in the Data Tables Reference.
  • The most common order table is your_project.sm_transformed_v2.obt_orders.
  • The most common order-line table is your_project.sm_transformed_v2.obt_order_lines.
  • The most common ad performance table is your_project.sm_transformed_v2.rpt_ad_performance_daily.
  • Product and SKU attributes are documented in dim_product_variants.
  • Metric and schema metadata live in your_project.sm_metadata.
  • Experimental attribution tables can live in your_project.sm_experimental.
  • Some report views live in your_project.sm_views.
If you are looking for raw platform data, such as direct GA4 export tables or a connector-specific dataset, confirm the dataset name in your BigQuery project. Raw source dataset names and availability can vary by organization and integration.
If a table exists in BigQuery but is not documented in the SourceMedium table reference, treat it as source-specific or organization-specific until your SourceMedium team confirms how it should be used.

Essential Queries

1. Daily Revenue Summary

Always filter with is_order_sm_valid = true to exclude test orders, cancelled orders, and other invalid transactions.

2. Channel Performance

3. New vs Returning Customers

4. Top Products by Revenue

5. Attribution by Source/Medium

6. Marketing Spend vs Revenue by Channel


Key Tables Reference

For complete table documentation, see the Data Tables Reference.

Important Filters

Valid Orders Only

Always include is_order_sm_valid = true to exclude:
  • Test orders
  • Cancelled orders
  • Fully refunded orders
  • Draft orders

Date Ranges

Use date_sub(current_date(), interval N day) for rolling windows:
  • Last 7 days: interval 7 day
  • Last 30 days: interval 30 day
  • Last 90 days: interval 90 day

Primary Date Field

Use order_processed_at_local_datetime as the primary date field for order analytics. This is the order processed timestamp converted to your reporting timezone.

Permissions & Sharing

BigQuery controls access through Identity and Access Management (IAM). In the warehouse SourceMedium manages for you, those permissions are set from your workspace rather than in Google Cloud, so you manage who can query by managing your team.
Warehouse access follows your SourceMedium workspace role.
  • Everyone with workspace access can query the sm_* datasets.
  • Nobody can write to the sm_* datasets. SourceMedium builds those.
  • Admins and Editors can also create datasets of their own alongside them, where your organization has its own BigQuery project. Where the warehouse is shared, every role has the same query-only access.
Invite them from Team in your SourceMedium workspace and pick a role. Access is granted when they accept, and it is removed when you remove them.You do not set this up in Google Cloud IAM, and a Google Group will not grant it. See Giving dashboard access to a teammate.
For Looker Studio data sources, we recommend using a service account as the Data Credential:
  • Ensures consistent access regardless of who created the data source
  • Simplifies permission management
  • Avoids issues when employees leave
See Provisioning Service Accounts for setup instructions.

Computing Power & Workload

BigQuery uses a reservation model with “slots” representing computational capacity for running queries.
SourceMedium Managed Data Warehouse customers receive a managed compute allowance for normal analytical usage.
For more details on managing compute resources, see the Workload Management Documentation.

BigQuery Tips

Click Preview on any table to see sample data without running a query (free).
BigQuery shows estimated data scanned in the top right corner of the query editor. This determines cost. Always check before running large queries.
Add LIMIT 100 while building queries to reduce costs and speed up iteration.
Use Save Query to store queries you run often. Organize with folders for easy access.
BigQuery supports arrays and structs (nested data). Use UNNEST() to flatten arrays for analysis. See Google BigQuery Data Types for details.

Getting Help


Additional Resources

Google Documentation: SourceMedium Resources: