Sub topic 5
Writing prompts that give usable results
This chapter covers how to write prompts for Copilot in Power BI so that the output needs little rework. It assumes you can navigate Power BI Desktop or the Power BI service, you know a star-schema model (fact tables, dimension tables, relationships), and you can write basic DAX measures. The same habits apply to report page prompts and to measure prompts. Later chapters use them to create pages, write DAX, and run queries.
Why prompt quality matters
Copilot does not see your intent. It sees your prompt text and the metadata of your semantic model: table names, column names, measures, relationships, descriptions, synonyms, and AI instructions. It then picks fields, visuals, or DAX syntax that fit both. A vague prompt leaves Copilot to guess, and it will guess differently each time.
A good prompt reduces the guessing. It names the subject, the breakdowns, the time range, and the result you want. The result is fewer rounds of correction.
Compare two prompts for the same request:
| Prompt | What Copilot has to guess |
|---|---|
| "Show me sales." | Which measure, which breakdowns, which period, which visuals, how many visuals |
| "Create a page that shows sales performance by product category and region for the last 12 months." | Which visuals to use for each part, and which fields match "sales" |
The second prompt still leaves some choices open, and that is acceptable. You can fix those in a follow-up prompt. The goal is to remove the guesses that would change the meaning of the numbers.
The parts of a strong prompt
A usable prompt usually covers four things.
- Subject. The business question or measure, such as sales performance or average order value.
- Breakdowns. The dimensions to split by, such as product category or region.
- Time range. A period that matches your date table, such as the last 12 months.
- Output. The visuals or the result you want, such as a monthly trend, a chart by category, or a slicer.
Here is a page-creation prompt that covers all four:
Create a page that shows sales performance by product category and region for the last 12 months. Include total sales, a monthly sales trend, sales by category, and a slicer for region.The subject is sales performance. The breakdowns are product category and region. The time range is the last 12 months. The output is a total, a trend, a category chart, and a slicer. Copilot has enough detail to choose fields and visuals without inventing a layout you did not ask for.
Use the words your model uses
Copilot matches your words to the names in the model. If your column is SalesAmount and your measure is Total Sales, then "sales" is probably enough. If your model uses internal names such as fct_ord_amt, Copilot has little to match against. Fix this in the model, not in the prompt. Chapter content on descriptions, synonyms, and AI instructions covers how.
When two fields could fit one word, name the one you want. "Sales" might mean gross sales, net sales, or a quota. Writing "net sales" removes the ambiguity.
State the edge case
For measures, the edge case is often the point of the prompt. Dividing by a count fails when the count is zero. If you do not say how to handle that, Copilot may or may not guard against it. Say so explicitly:
Write a measure that returns the average order value: total sales divided by the number of distinct orders. Handle the case where there are no orders.This prompt gives the business definition (total sales divided by distinct orders) and the edge case (no orders). Both parts matter. The definition tells Copilot which columns and aggregation to use. The edge case tells it to avoid an error.
Prompts for report pages and prompts for DAX
The two kinds of prompt differ in what they should contain.
| Aspect | Report page prompt | DAX measure prompt |
|---|---|---|
| Main content | Subject, breakdowns, time range, visuals | Business definition, inputs, edge cases |
| Typical output | A page with visuals and slicers | A measure expression with a name |
| What to specify | Which visuals and filters you want | Which existing measures or columns to reuse |
| Common mistake | Asking for "a dashboard" with no detail | Describing a result without defining it |
For a measure, define the calculation in business terms. Point to existing measures when you can. A base measure gives Copilot something to build on:
Total Sales = SUM ( Sales[SalesAmount] )With [Total Sales] in the model, a prompt that says "divided by the number of distinct orders" can produce a result that reuses it. This keeps your definitions in one place. If the definition of total sales changes later, every dependent measure changes with it.
The prompt above might return something like this:
Average Order Value =
DIVIDE ( [Total Sales], DISTINCTCOUNT ( Sales[OrderID] ) )DIVIDE returns a blank instead of an error when the denominator is zero. That is how the edge case in the prompt turns into code. Your result may differ in wording or structure. Treat it as a draft and check it, as described in the chapter on validating output.
Be specific about time
Time is the most common source of silent errors. "Last year" could mean the previous calendar year, the previous fiscal year, or the 12 months before today. State which one you mean.
For time intelligence, the model matters as much as the prompt. A year-over-year measure depends on a proper date table that is marked as the model's date table:
Sales LY =
CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
Sales YoY % =
DIVIDE ( [Total Sales] - [Sales LY], [Sales LY] )If you ask Copilot for "year over year growth" and the model has no marked date table, you may get an expression that runs but returns wrong or blank values. A prompt cannot repair that. When you write the prompt, name the date table and the period: "Using the Date table, write a year-over-year sales growth percentage."
Build prompts in steps
A single long prompt that asks for everything tends to produce a crowded result. Start with a focused request, check it, then add to it. A sequence might look like this:
- Create the base page: "Create a page that shows sales by product category for the last 12 months."
- Add a breakdown: "Add a slicer for region."
- Adjust a visual: "Change the category chart to a bar chart sorted by sales, highest first."
Each step is small enough to check. If step 2 goes wrong, you know the cause. The next chapters on refining pages cover this follow-up pattern further.
Common errors and how to fix them
Most poor results trace back to a small set of causes.
- Vague subject. "Show me performance" gives Copilot no measure to choose. Name the measure or the business concept.
- Missing time range. Without a period, Copilot may use all data or pick a default. State the range.
- Unclear terms. Words such as "revenue," "sales," and "income" may map to different fields. Use the term that appears in your model, or add a synonym to the model.
- No edge case. Measures that divide, rank, or compare periods need a rule for blanks and zeros.
- Too many requests at once. A prompt with ten visuals and five filters is hard to check. Split it.
- Asking for something the model cannot support. If the data has no cost column, no prompt will produce a margin. Check that the fields exist first.
- Trusting the first answer. A confident-looking result can still be wrong. Compare it with a figure you already know.
When a result is wrong, change one thing in the prompt and try again. If you change everything, you cannot tell which change helped.
Reusing a prompt as a template
Once a prompt works, keep it. A reusable pattern looks like this:
Create a page that shows [measure] by [dimension 1] and [dimension 2] for [time range]. Include [visual 1], [visual 2], and a slicer for [dimension].Fill in the brackets with names from your own model. For measures:
Write a measure that returns [business definition]. Use [existing measure] where possible. Handle the case where [edge case].A saved template gives consistent results across reports and across teammates, and it makes differences in output easier to trace.
A note on checking the result
A well-written prompt improves the draft but does not guarantee it is correct. Copilot can choose the wrong field, apply the wrong filter, or write DAX that runs but answers a different question. Compare generated visuals with a known total, and test generated measures in DAX query view before adding them to the model. The validation chapter covers these checks in detail.
Exercises
Exercise
A colleague writes the prompt "Show me sales." Copilot returns a page with an unexpected measure and no time filter. Rewrite the prompt so it covers the four parts of a strong prompt, using the model's fields (Product category, Region, Total Sales).
Show answer
One good version: "Create a page that shows total sales by product category and region for the last 12 months. Include a monthly sales trend, a chart of sales by category, and a slicer for region." It names the subject (total sales), the breakdowns (product category and region), the time range (last 12 months), and the output (trend, category chart, slicer).
Exercise
You ask Copilot for "average order value" and it returns Total Sales / DISTINCTCOUNT ( Sales[OrderID] ). The measure shows an error for a region that has no orders in the selected period. What was missing from the prompt, and what function fixes the expression?
Show answer
The prompt did not state the edge case for no orders. Adding "Handle the case where there are no orders" tells Copilot to guard the division. DIVIDE ( [Total Sales], DISTINCTCOUNT ( Sales[OrderID] ) ) returns a blank instead of an error when the denominator is zero.
Exercise
You ask for "year over year sales growth" and the measure returns blank for every month, even though the expression looks reasonable. Name two things to check besides the prompt wording.
Show answer
Check that the model has a date table with a continuous range of dates and that it is marked as the model's date table. Also check that the date column used in SAMEPERIODLASTYEAR comes from that date table and is related to the date column in the fact table. A prompt cannot compensate for a missing or unmarked date table.