
Customer storytelling in a dashboard starts with the right SQL output. Before you build views in Tableau or DISH reporting surfaces, you need a clean dataset that highlights customer behavior, trends, and meaningful segments.
Explain how you would use PostgreSQL and a visualization tool such as Tableau to tell a customer story. Focus on how you would shape the SQL output first, what metrics or cuts you would include, and how you would structure the result so it works well in a dashboard. You should also describe how you would move from raw customer records to a simple narrative such as acquisition, engagement, decline, or churn risk.
Keep your answer practical and analyst-focused. The interviewer is looking for a clear explanation of dataset design, aggregations, filtering, and how SQL choices support the final visual story rather than a deep discussion of Tableau features alone.
A customer story is easier to visualize when the SQL output is already summarized at a useful level, such as customer-month or segment-month. Choosing the right grain prevents cluttered dashboards and makes trends easier to explain.
SELECT customer_id, TO_CHAR(activity_date, 'YYYY-MM') AS activity_month, COUNT(*) AS interactions
FROM customer_activity
GROUP BY customer_id, TO_CHAR(activity_date, 'YYYY-MM');
Metrics such as total spend, average monthly usage, last activity date, or churn flags should be calculated in SQL so the dashboard uses consistent logic. This reduces ambiguity and makes the story reproducible across reports.
SELECT customer_id, SUM(monthly_revenue) AS total_revenue, MAX(activity_date) AS last_activity_date
FROM customer_activity
GROUP BY customer_id;
Simple segmentation helps turn raw numbers into a narrative. CASE expressions can classify customers into groups such as active, at-risk, or inactive based on usage or recency.
SELECT customer_id,
CASE
WHEN current_date - MAX(activity_date) <= 30 THEN 'Active'
WHEN current_date - MAX(activity_date) <= 90 THEN 'At Risk'
ELSE 'Inactive'
END AS customer_status
FROM customer_activity
GROUP BY customer_id;
Customer stories often depend on showing change over time. SQL should produce clean monthly or weekly summaries so Tableau can easily display trend lines, drop-offs, and recovery patterns.
SELECT TO_CHAR(activity_date, 'YYYY-MM') AS activity_month, COUNT(DISTINCT customer_id) AS active_customers
FROM customer_activity
GROUP BY TO_CHAR(activity_date, 'YYYY-MM')
ORDER BY activity_month;
A good dashboard dataset uses clear column names, limited transformations in the BI layer, and fields that map directly to filters and visuals. This keeps the dashboard maintainable and makes the story easier for stakeholders to follow.