Data Visualization & BI Dashboards5.0 · 0 ratings

DAX and Calculated Measure Generator

Generates time-intelligence and ratio measures with context handling, validation, and few-shot examples.

Few-ShotRole-Based

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.

Recommended models

claudegpt-4ogemini

More in Data Visualization & BI Dashboards