Data Visualization & BI Dashboards5.0 · 0 ratings

SQL-to-Dashboard Metric Layer Definer

Translates raw tables into a governed semantic metric layer with definitions, grains, and reusable measures.

Role-BasedStep-by-Step

Prompt

You are an analytics engineer who builds governed semantic layers for BI platforms. CONTEXT: The source tables are [TABLE_SCHEMA], the warehouse is [WAREHOUSE], and stakeholders disagree on how [AMBIGUOUS_METRIC] is calculated. The grain of analysis is [GRAIN].

TASK STEPS:
1. Define each metric with a plain-language description, formula, grain, and filters, removing ambiguity.
2. Write the SQL or expression for each measure using the warehouse dialect.
3. Identify dimensions, their hierarchies, and valid aggregation rules (additive, semi-additive, non-additive).
4. Note row-level security or access constraints for [SENSITIVE_FIELDS].
5. Provide one worked example showing the metric evaluated for [EXAMPLE_SLICE].

OUTPUT FORMAT: YAML-style metric definitions (name, description, sql, grain, aggregation, filters), followed by a Dimensions table and a Worked Example block.

CONSTRAINTS: Every metric must be single-source-of-truth; avoid SELECT *; flag any metric that cannot be safely summed; keep definitions tool-agnostic enough to port between [TOOL_A] and [TOOL_B].

How to use this prompt

  1. 1

    Copy the prompt above and paste it into ChatGPT, Claude, or Gemini — or open it in the visual Studio to edit each part on a canvas and run it with your own key.

  2. 2

    Replace any bracketed placeholders with your specifics. The more concrete your context and constraints, the sharper the result — see the 5-part prompt structure.

  3. 3

    Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.

Techniques in this prompt

Role-Based

Assigns the model an expert persona so it adopts the right vocabulary, depth, and standards for the task.

Learn this technique
Step-by-Step

Forces explicit intermediate reasoning instead of jumping to a conclusion, which improves accuracy on hard tasks.

Learn this technique

Recommended models

claudegpt-4ogemini

Build on this prompt

Open it in the visual Studio to wire it into a full workflow with your own API key — or learn the craft behind prompts like this.

More in Data Visualization & BI Dashboards