Sub topic 5
Writing prompts that give usable results
This chapter assumes you can build visuals and slicers by hand, that your semantic model is a star schema, and that you know basic DAX. It also assumes Copilot is already enabled for your workspace. The goal is to write prompts that Copilot can turn into a useful page or measure on the first or second try.
How Copilot reads a prompt
Copilot does not see your intent. It sees the text you type and the metadata of your semantic model: table names, column names, measures, descriptions, and synonyms. It matches the words in your prompt to those objects and then picks visuals or writes DAX. A vague prompt gives it little to match, so it guesses.
Four details make a prompt specific:
- Subject: the measure or business question, such as sales or order value.
- Breakdowns: the dimensions to split by, such as category or region.
- Time range: the period, such as the last 12 months.
- Visuals or output: what you want back, such as a trend, a slicer, or a measure.
A weak prompt and a strong prompt
Compare two prompts for the same page.
Weak: Show me sales.
Copilot has to choose the breakdown, the period, and the visuals. The result may be a single card that tells you little.
Strong:
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.This prompt names the subject (sales performance), the breakdowns (product category and region), the time range (last 12 months), and the visuals (total sales, a monthly trend, sales by category, a region slicer). Copilot can map each phrase to a field or visual type.
Prompts for DAX measures
For measures, state the business definition and the edge case. Copilot cannot know how your company defines a term, and it will not always think of empty results.
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.The prompt gives the formula in words and names the edge case. A result might look like this:
Average Order Value =
DIVIDE ( [Total Sales], DISTINCTCOUNT ( Sales[OrderID] ) )DIVIDE returns a blank instead of an error when the denominator is zero, which covers the edge case. Notice that the measure uses [Total Sales]. That base measure must already exist in the model:
Total Sales = SUM ( Sales[SalesAmount] )When a base measure exists, Copilot can reuse it. When it does not, Copilot may write the aggregation inline, and you end up with the same logic in several places.
Habits that improve results
- Use the names in your model. If the column is
Product[Category], say "category", not "type of product". Synonyms help, but exact names match best. - Define terms. Write "average order value: total sales divided by distinct orders" instead of assuming Copilot knows your definition.
- State the time range in concrete terms. "Last 12 months" is clearer than "recently".
- Ask for one thing at a time. Create the page first, then refine it. For DAX, ask for one measure per prompt.
- Name the edge cases. Mention empty results, missing dates, or blank values.
- Iterate. Treat the first answer as a draft and follow up with a correction.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Page uses the wrong field | Prompt wording does not match model names | Use the exact table and column names |
| Measure ignores your definition | Definition was left out | State the formula in words |
| Page has too few or too many visuals | Visuals were not listed | Name each visual you want |
| Time-based measure is wrong | No date table or no date range stated | Mark a date table and state the period |
Exercise
A colleague types "Make a measure for average sales" and gets a result that does not match what finance reports. Rewrite the prompt so it is more likely to produce the right measure, and name two details you added.
Show answer
For example: "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." The details added are the business definition (total sales divided by distinct orders) and the edge case (no orders). Using the model's own names, such as Total Sales, would also help.
Exercise
List the four details a page-creation prompt should include, and give one example of each for a page about returns.
Show answer
Subject: return rate. Breakdowns: by product category and store. Time range: the last 6 months. Visuals: a card for total returns, a line chart for monthly returns, and a slicer for store.