Overview
BigQuery is Google’s fully-managed, serverless data warehouse where your SourceMedium data lives. It excels at large-scale data analysis, handling complex data types, and provides granular access control through IAM integration. This guide provides practical queries you can run immediately against yoursm_transformed_v2 dataset.
Dataset location: All SourceMedium tables are in the
sm_transformed_v2 dataset within your Google Cloud project.Essential Queries
1. Daily Revenue Summary
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
| Table | Description | Key Columns |
|---|---|---|
obt_orders | One row per order | sm_order_key, order_net_revenue, sm_channel |
obt_order_lines | One row per line item | sm_order_line_key, product_title, order_line_quantity |
obt_customers | One row per customer | sm_customer_key, customer_email, source_system |
rpt_ad_performance_daily | Daily ad metrics by ad | date, sm_channel, ad_spend, ad_impressions |
Important Filters
Valid Orders Only
Always includeis_order_sm_valid = true to exclude:
- Test orders
- Cancelled orders
- Fully refunded orders
- Draft orders
Date Ranges
Usedate_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
Useorder_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 integrates with Identity and Access Management (IAM) to provide granular control over who has access to your data. You can assign specific roles to users and control their permissions on a project-wide or dataset-wide level.SourceMedium Managed Data Warehouse Admin Permissions
SourceMedium Managed Data Warehouse Admin Permissions
The For more details, see IAM Permissions Documentation.
SM Managed WH - Admin user role (the default role all Managed Data Warehouse customers receive) includes the following permissions:Granting access to team members
Granting access to team members
Use Google Groups to manage BigQuery access efficiently:
- Create a Google Group for your analytics team
- Grant the group BigQuery Data Viewer or Editor role
- Add team members to the group as needed
Service accounts for Looker Studio
Service accounts for Looker Studio
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
Computing Power & Workload
BigQuery uses a reservation model with “slots” representing computational capacity for running queries.SourceMedium Managed Data Warehouse customers receive up to 100 slot-hours to use at their discretion. Most businesses never reach this quota with normal analytical usage.
BigQuery Tips
Use Preview to avoid costs
Use Preview to avoid costs
Click Preview on any table to see sample data without running a query (free).
Check query cost before running
Check query cost before running
BigQuery shows estimated data scanned in the top right corner of the query editor. This determines cost—always check before running large queries.
Use LIMIT during development
Use LIMIT during development
Add
LIMIT 100 while building queries to reduce costs and speed up iteration.Save frequently-used queries
Save frequently-used queries
Use Save Query to store queries you run often. Organize with folders for easy access.
Handle complex data types
Handle complex data types
BigQuery supports arrays and structs (nested data). Use
UNNEST() to flatten arrays for analysis. See Google BigQuery Data Types for details.Getting Help
- Query errors: Check column names against the table documentation
- Permission issues: See Google Groups Access Control
- Data questions: Contact your SourceMedium support team
Additional Resources
Google Documentation:- GoogleSQL Reference
- Query Syntax
- Creating and Using Tables
- Introduction to Views
- Loading Data
- BigQuery Pricing

