How to use the DAX Formula Generator
- 1. Name your modelEnter the fact table, value column, measure name and date table.
- 2. Pick a calculationTotals, YTD, YoY %, running totals, moving averages, rank, top N and more.
- 3. Paste into Power BICopy the measure (and its base measure) into Modeling → New measure.
What it generates
The generator writes DAX in the style Power BI experts recommend. There are explicit base measures and VAR … RETURN for readability, DIVIDE instead of / for safe division, and REMOVEFILTERS-style ALL patterns for shares. Time intelligence covers TOTALYTD with an optional 31 March year end for the Indian financial year, TOTALMTD/TOTALQTD, SAMEPERIODLASTYEAR, DATEADD, running totals and moving averages with DATESINPERIOD. There are also % of category with ALLEXCEPT, RANKX with ISINSCOPE, TOPN totals, AVERAGEX per item and single-value CALCULATE filters. Table names are quoted where DAX needs it, for example 'Date'[Date].
Worked example
With a Sales table, an Amount column and a date table called Date, choosing Year-to-date with the year ending 31 March gives Total Sales YTD = TOTALYTD ( [Total Sales], 'Date'[Date], "3/31" ), plus the base measure Total Sales = SUM ( Sales[Amount] ). Choosing Year-on-year growth gives a VAR-based measure that compares [Total Sales] with CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) ) using DIVIDE. If this year is ₹12 lakh against ₹10 lakh last year, it shows 20%.
Before you paste
- Time intelligence needs a proper date table: one row per day, no gaps, marked as the date table and related to your fact table.
- We check brackets, quotes and names, but we can't run DAX outside Power BI, so test each measure in a visual.
- The same DAX works in Power Pivot in Excel and in Analysis Services.
Frequently asked questions
Why does it add a base measure?
Time-intelligence measures refer to [Total Sales]; creating it once and reusing it keeps your model consistent and easier to change.
Is 'Date' a problem as a table name?
It's common, but DATE is also a function, so the name must be quoted as 'Date'. The generator does this automatically.
Is the DAX formula generator free?
Yes. You can open the DAX formula generator and use it without signing up. When you generate a measure for the first time, we ask once for your name and WhatsApp number; after that it, and every other Uncodemy tool, opens straight away.