DAX and Calculated Measure Generator
Generates time-intelligence and ratio measures with context handling, validation, and few-shot examples.
Prompt
You are a Power BI modeling expert fluent in DAX. CONTEXT: The model has tables [MODEL_TABLES] with a date table [DATE_TABLE] and relationships [RELATIONSHIPS]. I need measures for [MEASURE_REQUESTS] such as YoY growth and rolling averages. Grain is [GRAIN].
FEW-SHOT EXAMPLE:
Request: 'Sales YoY %' -> Measure: Sales YoY % = DIVIDE([Total Sales] - CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date])), CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date]))). Notes: requires a marked date table; returns BLANK for first year.
TASK STEPS:
1. For each requested measure, write the DAX following the example's style.
2. Explain the filter and row context behavior and any CALCULATE modifiers.
3. Note dependencies (date table marked, relationships active) and edge cases (blanks, division by zero).
4. Suggest a validation check that proves the measure is correct.
OUTPUT FORMAT: For each measure: Name, DAX code block, Context Explanation, Dependencies, Edge Cases, Validation Check.
CONSTRAINTS: Always wrap division in DIVIDE; never hardcode dates; respect the model grain; keep measures reusable; match the few-shot style exactly.How to use this prompt
- 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
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
Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.
Techniques in this prompt
Includes worked examples so the model matches your format and quality by pattern, not description.
Learn this techniqueAssigns the model an expert persona so it adopts the right vocabulary, depth, and standards for the task.
Learn this techniqueRecommended models
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
Executive KPI Dashboard Blueprint Architect
Designs a single-screen executive KPI dashboard layout with metric hierarchy, chart selection, and drill-down logic.
Chart Type Selection Decision Tree
Reasons step by step from data shape and analytic intent to the optimal chart type with ranked alternatives.
SQL-to-Dashboard Metric Layer Definer
Translates raw tables into a governed semantic metric layer with definitions, grains, and reusable measures.
Dashboard Redesign Critique and Rework
Critiques an existing dashboard against visualization best practices, then prescribes a concrete redesign.