How to Forecast Revenue in Looker with AI
Building an accurate revenue forecast helps you shift from reacting to business performance to proactively shaping it. Instead of guesswork, you get a data-driven roadmap for budgeting, hiring, and setting strategic goals. This article will show you how to create powerful, AI-driven revenue forecasts directly within Looker, using both its native features and advanced integration with BigQuery ML.
Why Forecast Revenue in Looker?
For many teams, forecasting happens in spreadsheets. This usually involves a painful monthly ritual of exporting CSVs from various platforms, wrestling with formulas, and manually updating charts. This process is not only time-consuming but also prone to errors and instantly out of date. Looker provides a much better environment for several reasons:
- Centralized Data: Looker sits on top of your data warehouse, where your sales, marketing, and operational data already live. This means your forecast is built from the same single source of truth that powers all your other business reporting.
- Real-Time Insights: Unlike a static spreadsheet, a Looker forecast can update automatically as new data flows in. This allows you to track performance against your forecast in real-time and make quicker adjustments.
- Collaboration: Dashboards are easy to share with stakeholders, ensuring everyone from finance to marketing is working from the same projections and understands the underlying data.
Preparing Your Data for an Accurate Forecast
Any forecast, especially one powered by AI, is only as good as the data it’s built on. The principle of "garbage in, garbage out" is especially true here. Before you can start predicting the future, you need to ensure your historical data is clean, structured, and ready for analysis.
1. Ensure High-Quality Historical Data
Your model will learn patterns from your past performance. If your historical data is messy, your forecast will be unreliable. Pay close attention to:
- Completeness: Look for gaps in your data. Are there missing days or weeks of sales data? Gaps can confuse the forecasting algorithm.
- Consistency: Make sure your metrics are defined consistently over time. A change in how you define "revenue" halfway through last year will throw off the entire model.
- Outliers: Did you have a one-time viral moment or a massive bulk order that isn't representative of normal business? You might need to clean or smooth these outliers so they don't disproportionately skew the forecast.
2. Structure Your Data for Time-Series Analysis
Forecasting is a time-series problem, meaning the AI looks for patterns over time. To do this, your data needs a clear and consistent time dimension. In your LookML model, this means having a well-defined dimension group for your primary date field, like order_created_date.
A typical structured dataset for revenue forecasting would have at least two columns:
- A timestamp column (e.g.,
sale_date, aggregated by day, week, or month). - A numeric value column (e.g.,
total_revenue).
For more advanced forecasts, you can include additional columns (called regressors or features) that might influence revenue, such as marketing spend, website traffic, or holiday periods.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Method 1: Using Looker's Built-in Forecasting Feature
Looker has a simple, accessible forecasting feature built directly into its visualization settings. It uses established statistical algorithms (like ARIMA) to analyze your data and project future trends. This is the fastest way to get started and is surprisingly effective for straightforward time-series forecasting.
Step-by-Step Guide to Native Looker Forecasting
Step 1: Start with a New Explore
Navigate to an Explore containing your sales or revenue data. This is typically where you’d analyze historical sales performance.
Step 2: Select Your Date Dimension and Revenue Measure
In the field picker, select a time-based dimension (e.g., "Order Date" set to weekly or monthly) and the key metric you want to forecast (e.g., "Total Revenue"). This will generate a basic table of your revenue over time.
Step 3: Choose a Line Chart Visualization
Forecasting works on time-series visualizations, with the line chart being the most common choice. Click the Line chart option from the visualization bar to see your revenue trend over time.
Step 4: Enable the Forecast
Open the visualization editor by clicking the gear icon. Navigate to the Y tab. At the bottom, you'll find a section called Forecast. Toggle it on.
Step 5: Configure Your Forecast Settings
Once enabled, you’ll see several options to customize your forecast:
- Length: How many periods (days, weeks, months) do you want to forecast into the future?
- Prediction Interval: This adds an upper and lower bound to your forecast, creating a "cone of uncertainty." A 95% interval, for example, means the model is 95% confident the actual results will fall within that range. It's a great way to visualize best- and worst-case scenarios.
- Seasonality: Does your business have a predictable cycle? For example, an e-commerce store might have weekly seasonality (higher sales on weekends) and yearly seasonality (a spike in Q4). You can help the model by telling it what cycle to look for (e.g., 7 periods for daily data with a weekly cycle, or 12 periods for monthly data with a yearly cycle).
Once you run the query, Looker will automatically add the forecast to your line chart, often as a dotted line with the shaded prediction interval. It's that simple.
Method 2: Advanced Forecasting with BigQuery ML Integration
While Looker's built-in tool is great, it has its limits. It primarily uses one variable (your past revenue) to predict future revenue. But what if your revenue is influenced by your ad spend, promotions, or other known factors? For truly powerful, AI-driven forecasting, you can integrate Looker with Google BigQuery ML (BQML).
BQML allows you to build and run sophisticated machine learning models, including complex forecasting models, using standard SQL. You can then pull the results of these models directly into Looker for visualization.
Step 1: Create a Forecasting Model in BigQuery
First, you need to train a forecasting model in BigQuery. The ARIMA_PLUS model is an excellent choice for time-series forecasting. Open BigQuery and run a CREATE MODEL statement. This query tells BigQuery to create a machine learning model by analyzing your historical sales data.
CREATE OR REPLACE MODEL `your-project.your_dataset.revenue_forecast_model`
OPTIONS(
MODEL_TYPE='ARIMA_PLUS',
TIME_SERIES_TIMESTAMP_COL='transaction_date',
TIME_SERIES_DATA_COL='total_revenue'
) AS
SELECT
transaction_date,
total_revenue
FROM
`your-project.your_dataset.historical_sales`
WHERE transaction_date <= '2023-12-31'This SQL code trains an AI model named revenue_forecast_model on your historical sales table, identifying trends, seasonality, and other patterns.
Step 2: Generate Future Predictions with ML.FORECAST
Once your model is trained, you can use the ML.FORECAST function to ask it for predictions. The following query asks the model we just created to forecast the next 90 days of revenue.
SELECT
*
FROM
ML.FORECAST(MODEL `your-project.your_dataset.revenue_forecast_model`,
STRUCT(90 AS horizon, 0.9 AS confidence_level))Running this will produce a table with the forecasted dates, the predicted revenue (forecast_value), and columns for the upper and lower bounds of your confidence interval.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Step 3: Surface the Forecast in Looker with a Derived Table
Now, you need to get these results into Looker. The best way is to create a LookML derived table based on this forecast query.
In your LookML project, create a new view file and define a derived table using the SQL from Step 2:
view: revenue_forecast_bqml {
derived_table: {
sql: SELECT cast(forecast_timestamp as date) as forecast_date,
forecast_value,
prediction_interval_lower_bound,
prediction_interval_upper_bound
FROM ML.FORECAST(MODEL `your-project.your_dataset.revenue_forecast_model`,
STRUCT(90 AS horizon, 0.9 AS confidence_level)) ,,
}
dimension_group: forecast_date {
type: time
timeframes: [date, week, month]
sql: ${TABLE}.forecast_date ,,
}
measure: predicted_revenue {
type: sum
sql: ${TABLE}.forecast_value ,,
}
}This code makes your BQML forecast available as a view within Looker, which you can now join with other data and explore just like any other table.
Step 4: Visualize Your Historical and Forecasted Data Together
In Looker, you can now create an Explore that joins your historical sales view with your new revenue_forecast_bqml view.
- Bring in the
Transaction DateandTotal Revenuefrom your historical sales. - Bring in the
Forecast DateandPredicted Revenuefrom your BQML forecast view. - Create a line chart that plots both
Total RevenueandPredicted Revenueon the same Y-axis against the date.
The result is a powerful, seamless chart showing your historical performance followed by a sophisticated, AI-driven forecast of your future revenue.
Tips for Better and More Accurate Forecasts
- Incorporate External Factors: With BQML, you can include external regressors in your model. Add columns to your training data for advertising spend, promotions, or known holiday periods to create a much more context-aware forecast.
- Choose the Right Granularity: Are you trying to forecast daily, weekly, or monthly revenue? Daily forecasts can be noisy, while monthly forecasts might miss short-term trends. Experiment to see what works best for your business rhythm.
- Continually Retrain Your Models: Business conditions change. Schedule your BQML
CREATE MODELquery to run periodically (e.g., once a month) to ensure your model is always learning from the most recent data. - Use Confidence Intervals Wisely: Don't just show the forecasted line, always include the prediction interval. This communicates the level of uncertainty to stakeholders and grounds your strategic planning in reality. No forecast is perfect, but a range of probable outcomes is incredibly useful.
Final Thoughts
Moving your revenue forecasting from spreadsheets to Looker allows you to build a dynamic, reliable, and easily shareable view of your future business performance. Whether you use Looker's straightforward built-in features for a quick projection or leverage the power of BigQuery ML for a deeply customized AI model, you're embracing a more proactive and data-driven approach to strategy.
Of course, setting up BigQuery ML models and building out derived tables in Looker requires technical expertise and can be a significant undertaking. At Graphed, we believe getting these kinds of advanced insights shouldn't require a data engineering degree. Instead of writing SQL and LookML, you can connect your data sources and just ask natural language questions like, "forecast my Shopify revenue for the next 90 days." We handle the complex connections and AI modeling behind the scenes, delivering dashboards, reports, and forecasts in seconds. If you're looking for an easier way to get AI-powered answers from your data, you might want to try Graphed.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.