How to Create a DAX Measure with Copilot in Power BI
Writing DAX measures by hand can feel intimidating when you are taking your first steps in Power BI. Copilot in Power BI changes that: you describe the calculation in natural language and get a DAX measure ready to review, test, and save to your model. DAX measures are the calculation engine behind every Power BI report, so it is worth learning to create them with confidence. A perfect example to learn with is a year-to-date (YTD) sales measure — without memorising a single function.
Prerequisites
- A recent version of Power BI Desktop (update via Help > Check for updates if needed).
- A model with at least one fact table (for example,
Sales) and a calendar table (Calendar). - A numeric column to sum, such as
Sales[Amount], and a date column inCalendar[Date]. - Access to Copilot: Copilot in Power BI requires a Fabric capacity assigned to the workspace.
If you do not see the Copilot button, check with your administrator that an active Fabric capacity exists — without it, Copilot is not available.
Step 1: Open the DAX query view
In the icon bar on the left of Power BI Desktop, click the fourth icon, the DAX query view. This view works like a scratchpad: you can write, run, and test DAX code without changing the model. It is the ideal place to experiment with Copilot, because nothing is saved until you decide. If you do not see this icon yet, update Power BI Desktop to the latest version.
Step 2: Ask Copilot for the measure
With the view open, open Copilot from the Copilot button on the ribbon or with the CTRL + I shortcut inside the editor. Write the request in clear English, stating the measure name, the column to sum, and the date table. The more specific you are, the fewer corrections you will make later:
Create a measure called Sales YTD that sums Sales[Amount]
year-to-date, using the Calendar table.
Avoid vague requests like "calculate sales". Give context: which table, which column, and which period you want to analyse.
Step 3: Review the generated DAX
Copilot returns a complete DAX query, with a DEFINE MEASURE block and an EVALUATE statement to preview the values. The result should look similar to this:
DEFINE
MEASURE Sales[Sales YTD] =
TOTALYTD(SUM(Sales[Amount]), 'Calendar'[Date])
EVALUATE
SUMMARIZECOLUMNS(
'Calendar'[Year],
"Sales YTD", [Sales YTD]
)
The TOTALYTD function sums the value from the first day of the year up to the date in context — that is what produces the "year-to-date" effect. Always read the code before accepting it and confirm that the measure name, the summed column, and the date table match your model. Copilot speeds up the work, but the logic is your responsibility.
Step 4: Run and save the measure to the model
Click Run to see the preview in the lower grid. If the values make sense, look for the Update model: Add new measure link that appears above the DEFINE MEASURE block. Click it to save the measure to the model permanently. From that moment, it stops being a draft and becomes available in every report.
Verify the result
Switch to Model view or Report view and look for the new Sales YTD measure in the Data pane, usually with a calculator icon. Drag it into a table visual next to Calendar[Year] and confirm that the running total grows month after month, resetting each year. If a value comes out blank or with an error, the most likely cause is that the calendar table is not marked as a date table — fix it in Table tools > Mark as date table and run again.
Conclusion
With just a few clicks, you turned an English sentence into a working DAX measure saved to your model. From here, ask Copilot for variations — previous-year sales, percentage change, or a moving average — and compare the generated DAX to absorb the language patterns. What will be the next measure you ask Copilot for?