Sub topic 3
Drafting and Explaining Queries in DAX Query View
This chapter assumes you know basic DAX, filter context, and star-schema models. You should also be able to navigate Power BI Desktop and create a visual manually.
Drafting and explaining queries in DAX query view
DAX query view lets you write and run queries against the semantic model without first creating a permanent measure. Copilot can draft a query from a request such as:
> Show total sales and average order value by product category, ordered by total sales.
Review the draft before running it. Confirm that it uses the correct tables, columns, and measures.
DEFINE
MEASURE Sales[Average Order Value] =
DIVIDE (
[Total Sales],
DISTINCTCOUNT ( Sales[OrderID] )
)
EVALUATE
SUMMARIZECOLUMNS (
'Product'[Category],
"Total Sales", [Total Sales],
"Average Order Value", [Average Order Value]
)
ORDER BY [Total Sales] DESCDEFINE creates a measure for this query only. EVALUATE returns a table. SUMMARIZECOLUMNS groups the results by category and calculates the requested expressions. ORDER BY sorts the result.
You can also ask Copilot to explain a query. Compare its explanation with the actual DAX. An explanation is useful for review, but it does not prove that the query is correct.
Checking Copilot's work before you publish
Compare query results with trusted totals from the source system or an existing report. Check filters, date relationships, duplicate rows, blank values, and the handling of zero denominators. Test several categories and time periods, not only the grand total.
For a generated visual, verify its fields, aggregation, sort order, and filter interactions. A plausible chart can still use the wrong date column or an unintended relationship.
Known limits and troubleshooting
Copilot may misunderstand business terms, invent a column, or choose an unsuitable aggregation. It cannot repair missing relationships or poorly named fields. If it returns incomplete or invalid DAX, state the table names, desired grain, filters, and edge cases explicitly. Check that the model is supported, Copilot is enabled, and your workspace has the required capacity and permissions.
Responsible use and data governance
Treat Copilot as an assistant, not an approver. Do not include confidential information in prompts unless your organization's policy allows it. Apply existing workspace permissions, sensitivity labels, and sharing rules. Record important manual corrections and have a domain expert approve calculations used for business decisions.
Exercise
Why should you run a Copilot-generated query against known results before using it?
Show answer
Because valid-looking DAX can still use the wrong fields, relationships, filters, or aggregation and produce misleading results.