Stop building dashboards that look impressive but leave your team asking, “So, what should we do next?”
Imagine you're running marketing for an e-commerce brand.
It's Monday morning. Your manager asks five questions:
- Why did revenue fall last week?
- Which campaign brought in the most profitable customers?
- Are we spending more to acquire each customer?
- Which channel should receive the next ₹50,000?
- Did our latest campaign actually generate additional sales?
You open your marketing dashboard.
There are 20 charts, 14 filters, and dozens of metrics. Everything looks professional.
But you still can't answer the questions.
So you ask an AI assistant.
It responds confidently:
"Revenue declined because Meta Ads performance weakened and customer acquisition costs increased."
Sounds reasonable. But did revenue really decline because of Meta Ads? Did acquisition costs increase? Is there evidence connecting the two?
If your AI assistant doesn't have access to reliable data, consistent metric definitions, and the right analytical tools, that answer may be nothing more than a plausible guess.
The goal isn't to build a dashboard that AI can describe. It's to build a dashboard where AI can investigate questions using verified data. 📊
In this guide, we'll design a marketing analytics dashboard that combines trustworthy metrics, SQL, clear visualizations, and an AI assistant that knows when it has enough evidence—and when it doesn't.
1. The problem with most marketing dashboards
Many dashboards are built around the data that's easiest to display.
A typical marketing dashboard might show:
- Impressions
- Clicks
- Click-through rate (CTR)
- Cost per click (CPC)
- Conversion rate
- Cost per acquisition (CPA)
- Return on ad spend (ROAS)
- Revenue
These metrics are useful. But a collection of metrics isn't the same as an analytical system.
Consider this situation:
| Metric | Previous week | Current week |
|---|---|---|
| Ad spend | ₹80,000 | ₹90,000 |
| Clicks | 12,000 | 14,000 |
| Purchases | 600 | 560 |
| Revenue | ₹9,00,000 | ₹8,40,000 |
Your dashboard tells you that spending and clicks increased while purchases and revenue declined.
That's the what.
But what caused it?
Possible explanations include:
- Traffic quality deteriorated.
- The conversion rate fell.
- Average order value decreased.
- A high-performing campaign lost effectiveness.
- A website checkout issue prevented purchases.
- The campaign mix changed.
- Tracking became inconsistent.
A chart showing revenue alone cannot distinguish these explanations.
The dashboard needs reliable underlying data and the ability to investigate relationships between metrics.
The shift I'd make
Instead of starting with:
"What charts should we build?"
Start with:
"What decisions must this dashboard help someone make?"
That single change influences your data model, SQL queries, KPI definitions, visualizations, and AI architecture.
2. Design the dashboard around business questions
I'd organize the dashboard around six categories of questions.
| Business question | Metrics and analysis required |
|---|---|
| Are we growing? | Revenue, orders, new customers, growth rates |
| Is marketing efficient? | Spend, CAC, ROAS, contribution after marketing |
| Which channels perform best? | Channel-level spend, conversions, customer quality |
| Where are we losing customers? | Funnel conversion rates and drop-off points |
| Why did performance change? | Period comparisons, campaign mix, traffic and conversion analysis |
| What should we do next? | Evidence-backed opportunities, constraints, and experiments |
This approach prevents the dashboard from becoming a gallery of charts without a clear purpose.
It also gives your AI assistant a defined set of analytical tasks.
For example, if someone asks, "Why did revenue fall?", the system should know to investigate order volume, average order value, channel mix, and conversion rates rather than immediately generating a narrative.
3. Choose a practical technology stack
You don't need an enterprise data platform to build a useful first version.
For a portfolio project or a small business, I'd start with a stack that's relatively simple to implement and extend.
Suggested architectureData sources
Google Ads · Meta Ads · GA4 · CRM · Orders
Ingestion and transformation
APIs / CSVs · Python · scheduled jobs · SQL
Analytics data model
PostgreSQL or a cloud warehouse · validated metrics
Dashboard
Power BI, Tableau, or Streamlit
AI analyst
LLM + controlled query tools
Validated answers
Metrics · comparisons · evidence · caveats · next steps
What each component does
- Python: Retrieves, cleans, and validates source data.
- SQL: Calculates metrics and supports repeatable analysis.
- PostgreSQL or a warehouse: Stores structured analytical data.
- Power BI, Tableau, or Streamlit: Presents metrics and visualizations.
- An LLM: Interprets business questions and explains query results.
- A controlled query layer: Ensures the AI uses approved definitions and permitted data.
For a portfolio project, you could use CSV exports initially and add API integrations later. This keeps the first version manageable without pretending that a CSV-based prototype is already a production-grade live system.
4. Build a trustworthy data model first
This is the part many AI dashboard projects underestimate.
If your data is inconsistent, your dashboard will be inconsistent. If your dashboard is inconsistent, the AI will confidently explain inconsistent numbers.
Let's assume you have four core tables.
fact_ad_performance
One row per date, campaign, and relevant reporting dimensions.
CREATE TABLE fact_ad_performance ( report_date DATE NOT NULL, platform TEXT NOT NULL, campaign_id TEXT NOT NULL, campaign_name TEXT, spend NUMERIC(14, 2), impressions BIGINT, clicks BIGINT, reported_conversions NUMERIC(14, 2) ); fact_orders
One row per order, with appropriate handling for order status and refunds.
CREATE TABLE fact_orders ( order_id TEXT PRIMARY KEY, customer_id TEXT, order_timestamp TIMESTAMP NOT NULL, order_status TEXT NOT NULL, gross_revenue NUMERIC(14, 2), discount_amount NUMERIC(14, 2), refund_amount NUMERIC(14, 2), currency TEXT NOT NULL ); dim_campaign
Stores campaign metadata such as channel, objective, and naming conventions.
fact_sessions
Stores session-level or event-level website analytics, depending on the tracking setup and data volume.
Important: These are illustrative schemas, not a complete universal data model. Production implementations need appropriate primary keys, source identifiers, time-zone handling, data types, ingestion timestamps, and deduplication rules.
Why separate ad conversions from actual orders?
Because a conversion reported by an ad platform is not necessarily identical to a completed order in your commerce system.
They may differ because of attribution windows, view-through conversions, refunds, duplicate events, identity matching, or reporting delays.
Keep platform-reported conversions and actual business transactions distinguishable. That makes reconciliation possible.
5. Define your KPIs before writing the dashboard
The same metric can be calculated differently by different teams.
For example, one person may calculate ROAS using gross sales, while another uses net revenue after discounts and refunds.
Both calculations might be mathematically valid, but comparing them as if they were identical creates confusion.
Create a metric dictionary.
| Metric | Example definition | Key caveat |
|---|---|---|
| Ad spend | Sum of platform-reported spend | Define taxes and currency treatment |
| Net revenue | Gross revenue minus defined discounts and refunds | Specify treatment of cancellations and shipping |
| CTR | Clicks ÷ impressions | Define the click type |
| CPC | Spend ÷ clicks | Handle zero clicks |
| Conversion rate | Defined conversions ÷ defined visits or clicks | State the denominator |
| ROAS | Defined attributed revenue ÷ ad spend | Attribution rules matter |
| CAC | Relevant acquisition costs ÷ new customers | Define which costs are included |
| Contribution after marketing | Contribution before acquisition costs minus relevant marketing costs | Requires reliable cost data |
You should also document:
- The source of each metric.
- The reporting period and time zone.
- Whether the metric is daily, weekly, or monthly.
- How missing values are handled.
- Whether it is observed, attributed, or estimated.
- Which comparisons are valid.
This metric dictionary becomes the shared contract between your SQL, dashboard, and AI assistant.
6. Write SQL that answers real business questions
Let's turn the framework into actual analysis.
Question 1: Which campaigns have the highest reported ROAS?
SELECT platform, campaign_id, campaign_name, SUM(spend) AS ad_spend, SUM(reported_conversions) AS reported_conversions, CASE WHEN SUM(spend) > 0 THEN SUM(reported_conversions) / SUM(spend) ELSE NULL END AS conversions_per_currency_unit FROM fact_ad_performance WHERE report_date >= CURRENT_DATE - INTERVAL '30 days' GROUP BY platform, campaign_id, campaign_name ORDER BY conversions_per_currency_unit DESC; This query calculates conversions per currency unit, not ROAS, because the sample ad table doesn't contain attributed revenue. That distinction matters.
To calculate ROAS, you need a consistently defined attributed-revenue field or a validated attribution dataset that can be joined to campaign data without duplicating conversions.
Never label a metric "ROAS" just because it appears in a campaign-performance query.
Question 2: How did actual revenue change week over week?
WITH weekly_revenue AS ( SELECT DATE_TRUNC('week', order_timestamp)::date AS week_start, SUM( gross_revenue - COALESCE(discount_amount, 0) - COALESCE(refund_amount, 0) ) AS net_revenue FROM fact_orders WHERE order_status IN ('completed', 'partially_refunded') GROUP BY 1 ), revenue_comparison AS ( SELECT week_start, net_revenue, LAG(net_revenue) OVER ( ORDER BY week_start ) AS previous_week_revenue FROM weekly_revenue ) SELECT week_start, net_revenue, previous_week_revenue, net_revenue - previous_week_revenue AS revenue_change, CASE WHEN previous_week_revenue > 0 THEN 100.0 * (net_revenue - previous_week_revenue) / previous_week_revenue ELSE NULL END AS revenue_change_pct FROM revenue_comparison ORDER BY week_start DESC; This query assumes the listed order statuses and revenue treatment match your business definitions. Adjust them to your source system.
It provides a verified starting point for investigating revenue changes. It doesn't automatically explain why the change occurred.
Question 3: Which campaigns are generating expensive clicks?
SELECT platform, campaign_name, SUM(spend) AS spend, SUM(clicks) AS clicks, CASE WHEN SUM(clicks) > 0 THEN SUM(spend) / SUM(clicks) ELSE NULL END AS cost_per_click FROM fact_ad_performance WHERE report_date >= CURRENT_DATE - INTERVAL '30 days' GROUP BY platform, campaign_name ORDER BY cost_per_click DESC NULLS LAST; This can identify campaigns worth investigating. High CPC alone doesn't mean a campaign is bad: it may attract higher-value customers or convert at a better rate.
The next query should examine the relevant downstream outcome.
7. Design the dashboard around investigation, not decoration
I'd divide the dashboard into five useful views.
View 1: Executive overview
Show the core business outcomes:
- Net revenue.
- Actual orders.
- New customers.
- Marketing spend.
- CAC.
- Contribution after marketing.
Include comparisons with the previous period and clearly state the date range.
View 2: Channel performance
Compare Google Ads, Meta Ads, organic search, email, and other meaningful channels.
Display spend, relevant conversions, acquisition costs, and attributed revenue—but distinguish attributed results from actual business totals.
View 3: Funnel analysis
Show how users move from visits to product views, add-to-carts, checkout, and completed purchases.
Make sure the funnel stages use compatible populations and time windows. Otherwise, the apparent drop-off may be misleading.
View 4: Campaign diagnostics
Allow users to investigate individual campaigns, creative performance, audience segments, and changes over time.
View 5: AI analysis
Let users ask questions in plain English and receive:
- A direct answer.
- The metrics used.
- The comparison period.
- A supporting table or chart.
- Important limitations.
- A suggested next investigation.
The AI panel should complement the dashboard, not hide the underlying evidence.
8. Now add AI—but don't let it invent the numbers
This is where the project becomes interesting.
A basic AI dashboard might send a prompt like this to an LLM:
"You are a marketing analyst. Explain why our revenue decreased this month."
If the model receives no verified data, it may generate a plausible answer based on general marketing knowledge.
That isn't analytics.
A stronger architecture lets the model interpret the question, call approved analytical tools, and explain the returned results.
User asks a question ↓ LLM identifies the metric and time period ↓ Query planner selects approved analytical tools ↓ SQL runs against validated data ↓ Results pass checks and are returned ↓ LLM explains the evidence and limitations ↓ Answer + table/chart + source details Example: a question the AI should investigate
User:
Why did revenue fall last week?
The AI should not immediately answer that advertising performance declined.
It should investigate:
- Did the number of orders fall?
- Did average order value change?
- Did the conversion rate change?
- Did channel-level traffic or spend change?
- Did a technical issue affect checkout?
- Is the available data complete enough to compare the periods?
Suppose the validated data shows:
- Orders fell by 8%.
- Average order value fell by 3%.
- Total revenue fell by approximately 10.8%.
The combined effect is:
[
(1-0.08)\times(1-0.03)-1=-10.76\%
]
The AI can now report that the revenue decline is consistent with fewer orders and a lower average order value.
It should then investigate why those metrics changed, rather than claiming it has already established the cause.
That's the difference between generating an explanation and performing an analysis.
9. Build an AI assistant with controlled analytical tools
For a portfolio implementation, you can use Python, SQLAlchemy, an LLM API, and a dashboard framework such as Streamlit.
The critical design choice is to expose a small set of controlled tools rather than giving the model unrestricted access to your database.
Possible tools include:
get_kpi_summary(start_date, end_date)compare_periods(metric, current_period, previous_period)get_channel_performance(start_date, end_date)get_campaign_trends(campaign_id, start_date, end_date)analyze_funnel(start_date, end_date)check_data_quality(start_date, end_date)
Each tool should validate its arguments and return structured results.
Example: a controlled KPI function
from sqlalchemy import text def get_kpi_summary(connection, start_date, end_date): query = text(""" SELECT COUNT(*) FILTER ( WHERE order_status = 'completed' ) AS completed_orders, SUM( gross_revenue - COALESCE(discount_amount, 0) - COALESCE(refund_amount, 0) ) FILTER ( WHERE order_status IN ( 'completed', 'partially_refunded' ) ) AS net_revenue FROM fact_orders WHERE order_timestamp >= :start_date AND order_timestamp < :end_date """) return connection.execute( query, { "start_date": start_date, "end_date": end_date, } ).mappings().one() This example assumes that order_status, timestamp boundaries, and revenue fields have been defined correctly for your business. Production systems should validate date ranges, permissions, currency handling, and the completeness of the underlying data.
Notice what's happening here:
- The SQL is controlled by the application.
- User-supplied dates are passed as parameters.
- The model doesn't need to invent the revenue figure.
- The result comes from the analytical database.
You can add more tools as your dashboard grows.
What about text-to-SQL?
Text-to-SQL can be useful when users need flexible exploration. But don't allow generated SQL to run directly against a production database without safeguards.
A safer implementation should use:
- Read-only database permissions.
- An allowlisted set of tables and columns.
- Query validation and parameterization.
- Execution timeouts and result limits.
- A restricted schema or semantic layer.
- Logging and audit trails.
- Human review for sensitive or consequential actions.
For a first version, controlled query templates are often easier to validate than unrestricted SQL generation.
10. Make the AI show its evidence
A good analytical answer should be auditable.
Suppose a user asks:
Which channel should receive an additional ₹50,000 next month?
A weak AI answer:
Increase Meta Ads because it has the highest engagement and strong growth potential.
That answer doesn't establish profitability, incremental impact, or whether the channel can scale efficiently.
A stronger answer would look more like this:
Finding: Meta Ads has the highest attributed revenue in the selected period.
Evidence: The report shows its spend, attributed revenue, customer acquisition cost, and performance trend for the same date range.
Limitation: Attributed revenue can include purchases that would have happened without the ad. The report alone doesn't establish incremental return.
Recommendation: Before committing the entire additional budget, test a controlled increase in spend and evaluate incremental conversions and contribution margin.
This is more useful because the AI separates observations from hypotheses and recommendations.
A response contract for the AI
Require the assistant to structure answers around:
- Answer: What does the verified data show?
- Evidence: Which metrics and periods support the answer?
- Interpretation: What might explain the pattern?
- Uncertainty: What cannot be established from the available data?
- Next step: Which analysis or experiment would reduce uncertainty?
If the data is missing, incomplete, or inconsistent, the assistant should say so.
A trustworthy assistant must be allowed to answer, "I can't determine that from the available data."
11. Data quality: the layer that prevents confident nonsense
Even a well-designed AI system can produce misleading answers when the source data is unreliable.
Imagine your Meta Ads data arrives every morning, but your order database updates every hour.
If the dashboard compares today's ad spend with incomplete sales data, the campaign may look unprofitable simply because the purchase records haven't arrived yet.
Or suppose one campaign reports revenue in INR while another source stores values in USD. Without currency normalization, the comparison becomes meaningless.
Build data-quality checks for:
- Missing dates.
- Duplicate campaign records.
- Duplicate orders and conversion events.
- Unexpected null values.
- Invalid or negative spend values.
- Currency mismatches.
- Late-arriving data.
- Tracking outages.
- Revenue reconciliation differences.
You should also display the last successful data refresh and the date range covered by each source.
Never allow an AI explanation to hide a data-quality problem.
When the underlying data is incomplete, the answer should explicitly state that limitation.
12. How to evaluate whether the AI is actually useful
Don't evaluate your AI dashboard by asking whether its answers sound intelligent.
Evaluate whether it answers business questions correctly and consistently.
Create a test set of questions with known answers.
| Test question | What should be verified |
|---|---|
| What was net revenue last month? | Matches the validated KPI query |
| Which channel spent the most? | Correct spend aggregation and period |
| How did CAC change week over week? | Correct customer definition and comparison |
| Why did conversion rate fall? | Investigates relevant funnel metrics before explaining |
| Which campaign had the best ROAS? | Uses the approved attributed-revenue definition |
| Is the data complete for this week? | Correctly identifies missing or delayed records |
| Which channel caused the revenue decline? | Does not claim causality without adequate evidence |
Track:
- Numerical accuracy.
- Correct metric definitions.
- Correct date filters.
- SQL or tool-call success rate.
- Evidence coverage.
- Unsupported causal claims.
- Appropriate refusal when data is insufficient.
- Response latency and cost.
A model that says "I don't have enough evidence" when it genuinely lacks the data is performing better than a model that invents a confident answer.
13. A practical 14-day implementation roadmap
You can build a strong portfolio version without attempting to integrate every advertising platform on day one.
Days 1–2: Define the business questions
Choose a use case, such as a D2C e-commerce brand. Define the primary KPIs, the target users, and the decisions the dashboard should support.
Days 3–4: Prepare the data
Use a clearly documented synthetic dataset or legitimate exports. Clean the data, standardize dates and currency, and create the initial database tables.
Days 5–6: Build the SQL layer
Write and validate queries for revenue, orders, CAC, ROAS where supported, funnel conversion, and period comparisons.
Days 7–8: Build the dashboard
Create the executive overview, channel comparison, funnel view, and campaign diagnostics.
Days 9–10: Add the AI assistant
Expose controlled analytical tools. Let the LLM select tools, interpret returned metrics, and produce evidence-backed explanations.
Days 11–12: Add safeguards
Implement permissions, input validation, query limits, data-quality warnings, and an explicit response format.
Days 13–14: Test and document
Evaluate the assistant against questions with known answers. Document architecture, metric definitions, limitations, and sample investigations. Record a short demo showing a question, the underlying query, and the verified result.
A polished, reproducible dashboard with honest limitations is more impressive than a huge project that cannot be trusted.
14. Turn this into a standout portfolio project
If you're building this as a marketing analytics or product analytics portfolio project, don't stop at the charts.
Give the project a clear name:
Marketing Intelligence Copilot: An Evidence-Based Analytics Dashboard
Include these deliverables:
- A working dashboard with filters and KPI cards.
- A documented analytical data model.
- SQL queries for key business questions.
- A metric dictionary.
- An AI assistant that calls controlled query tools.
- Evidence-backed answers with source metrics and date ranges.
- A data-quality and freshness panel.
- A test suite with known answers and failure cases.
- A README showing the architecture and how to run the project.
For the demonstration, show a realistic scenario:
- Revenue declines week over week.
- The user asks why.
- The assistant queries verified order and campaign data.
- The dashboard displays the supporting numbers.
- The assistant distinguishes what is known from what still needs investigation.
- It proposes a measurable experiment rather than pretending to know the cause.
That final step demonstrates analytical judgment—not just technical implementation.
Final thoughts: AI should explain the data, not replace it
The most valuable marketing analytics dashboard isn't the one with the most charts or the most conversational AI.
It's the one that connects trustworthy data to decisions.
Build clear metric definitions. Validate the source data. Use SQL for repeatable calculations. Give the AI controlled tools instead of unrestricted authority. Show evidence alongside every important answer. And distinguish correlation, attribution, and causation.
AI can help marketers investigate faster, explain complex results, and explore data using natural language.
But the numbers must come from reliable sources, the calculations must be correct, and the conclusions must be proportional to the evidence.
Don't build an AI that guesses what your marketing data means. Build a system that helps you discover what the data actually supports. 🤖📈
