DAX is powerful, but the learning curve is steep — and the error messages are often useless. Here's the good news: AI can write your DAX formulas for you. And not just simple ones. I'm talking calculated columns, complex measures, time intelligence, and even debugging that formula that's been broken for three days.
I've been using Claude AI (made by Anthropic) to accelerate my Power BI work, and it's genuinely changed how I build reports. This guide shows you exactly how to do it.
Why Claude for DAX?
You might be wondering why Claude specifically, when ChatGPT exists. A few reasons:
Context window. Claude can hold significantly more context in a single conversation. When you're pasting in your data model, multiple measures, and asking complex questions, this matters.
Reasoning on complex logic. DAX requires understanding relationships, filter context, and evaluation order. Claude tends to think through these problems step-by-step rather than guessing.
It admits when it's uncertain. Instead of confidently giving you wrong syntax, Claude will flag when something might not work and explain why.
That said, any AI can help. The techniques below work with Claude, ChatGPT, or whatever you prefer.
The Basic Workflow
Here's how I approach any DAX problem with AI:
- Describe your data model (tables, relationships, key columns)
- Explain what you want to calculate in plain English
- Provide context on how it will be used (visual type, filters, slicers)
- Ask for the formula with an explanation
- Test, then iterate if needed
Let me show you this in action.
Example 1: Year-Over-Year Growth
The request: "I have a Sales table with columns: Date, Revenue, Product. I have a Date table connected to Sales on Date. I need a measure that shows year-over-year revenue growth as a percentage."
What Claude returns:
YoY Growth % =
VAR CurrentYearRevenue = SUM(Sales[Revenue])
VAR PreviousYearRevenue =
CALCULATE(
SUM(Sales[Revenue]),
SAMEPERIODLASTYEAR(DateTable[Date])
)
RETURN
IF(
PreviousYearRevenue = 0,
BLANK(),
DIVIDE(
CurrentYearRevenue - PreviousYearRevenue,
PreviousYearRevenue
)
)
Claude also explains why it uses DIVIDE instead of division (handles divide-by-zero), why it checks for zero before calculating (avoids misleading percentages), and how SAMEPERIODLASTYEAR interacts with filter context.
This is the real value — not just the formula, but understanding why it works.
Example 2: Running Total with Reset
The request: "I need a running total of Revenue that resets at the beginning of each month."
What Claude returns:
Running Total (Monthly Reset) =
CALCULATE(
SUM(Sales[Revenue]),
FILTER(
ALL(DateTable[Date]),
DateTable[Date] <= MAX(DateTable[Date]) &&
MONTH(DateTable[Date]) = MONTH(MAX(DateTable[Date])) &&
YEAR(DateTable[Date]) = YEAR(MAX(DateTable[Date]))
)
)
It walks through the logic: we're removing all date filters, then applying a new filter that includes only dates up to the current row AND within the same month and year.
Example 3: Debugging Broken Formulas
This is where AI really shines. Paste your broken formula, the error message (if any), and describe what's happening versus what you expected.
The request: "This formula returns blank when I use it in a matrix, but works in a card. Why?"
Total Sales = CALCULATE(SUM(Sales[Revenue]), ALL(Sales))
Claude's diagnosis: The formula uses ALL(Sales), which removes all filters from the Sales table. In a card, this gives you the grand total — which is what you see. In a matrix, you probably want it to respect the row/column context but ignore slicer filters.
Suggested fix:
Total Sales = CALCULATE(SUM(Sales[Revenue]), REMOVEFILTERS(Sales[Product]))
This kind of debugging would take hours of Googling. AI gets there in seconds.
Prompts That Work Well
Here are templates you can copy and modify:
For new measures:
I have these tables and relationships:
- [Describe your model]
I need a DAX measure that:
- [Plain English description]
It will be used in:
- [Visual type, what's on rows/columns, what slicers exist]
Please provide the formula and explain how it handles filter context.
For debugging:
This DAX formula isn't working as expected:
[Paste formula]
What's happening: [Describe actual behavior]
What I expected: [Describe expected behavior]
Error message (if any): [Paste error]
My data model: [Brief description]
Common Mistakes to Avoid
Don't forget to describe your data model. AI can't read your mind. If you don't mention that your Date table is called "Calendar" instead of "Date," you'll get formulas that don't work.
Don't accept the first answer blindly. Always test. AI occasionally hallucinates function names or uses syntax that doesn't exist in DAX.
Don't skip the explanation. If you don't understand why a formula works, you won't be able to modify it later. Ask follow-up questions until it clicks.
The Bottom Line
AI won't replace the need to understand DAX fundamentals — but it dramatically accelerates the learning process and eliminates the blank-page problem. Instead of spending 30 minutes hunting through Stack Overflow, you get a working formula in 30 seconds and an explanation that actually teaches you something.
If you're building Power BI reports for clients and want to move faster, this workflow is a no-brainer.
New to Power BI? See my comparison of Power BI vs Looker Studio to decide which tool fits your agency.
Need help automating your entire reporting workflow?
I help teams cut their weekly reporting time from 8 hours to 20 minutes.
Book a Free 15-Minute Audit →