MSBA-250 · Lesson 4 of 12 · 21 min
Calculated, rollup and formula columns
▶ Video coming soon A video version of this lesson is on the way.
Octavia's favorite question at the weekly facilities meeting is short: "How many open failures, and how old is the oldest?" In the spreadsheet days, Kwabena answered it with a pivot table and some patience. In the new model the answer could live on the data itself: each inspection could show how many of its findings failed, how many are still open and how long it has been open. Signe set aside a session to build those values, and to explain why Dataverse has four different ways to calculate a column.
This lesson covers the column types that compute their own values: formula columns, written in Power Fx; calculated columns, built with the classic condition-and-action editor; rollup columns, which aggregate related rows; and prompt columns, which use a generative AI model. It also covers row summaries, which produce an AI summary of a row on forms and views. AB-410 asks candidates to configure calculated, rollup and formula columns, and to configure prompt columns and row summaries, and to know when each is the right tool.
Why calculate in the data at all
You can always calculate a value in an app formula, a flow or a report. Calculating it in the table instead means the value is defined once and is the same everywhere: on the model-driven form, in the canvas app, in a Power BI report, in an export to Excel and in an answer from a Copilot Studio agent. It also means nobody has to remember to update it. The trade-off is that each kind of calculated column has rules about when it is computed, what it can reference and where it can be used, so choosing the right kind matters.
| Kind | Written with | Computed | Best for |
|---|---|---|---|
| Formula column | Power Fx | When the row is read | Values from the same row or related parent rows |
| Calculated column | Conditions and actions in a designer | When the row is read | Existing solutions that already use them |
| Rollup column | An aggregate over related rows | By a scheduled background job, or on demand | Counts, sums, minimums, maximums and averages of child rows |
| Prompt column | A natural-language prompt | Asynchronously, when the row is created or its inputs change | AI-generated text from other columns |
| Row summary | A prompt configured for the table | When a user views the row | A readable summary on forms and views |
Formula columns
A formula column is defined by a Power Fx formula, the same language used in canvas apps and many Power Platform features. When a row is retrieved, Dataverse evaluates the formula and returns the result, so the value is always current and never stored stale. Formula columns can use other columns in the same row and columns of related parent rows through lookups, and they support a subset of Power Fx functions for text, logic, numbers and dates. Microsoft recommends formula columns for new calculations that calculated columns used to handle.
To create one, add a new column, choose Formula as the data type, and type the formula in the formula bar; Copilot can also suggest a formula from a description such as "the number of days between Opened On and Closed On, or until today if it is still open". The result type follows the formula: text, a whole or decimal number, a date, a yes or no value, or a choice. You can set the format of the result, such as the number of decimal places.
// Days Open on Finding (whole number)
If(
IsBlank('Resolved On'),
DateDiff('Found On', UTCToday(), TimeUnit.Days),
DateDiff('Found On', 'Resolved On', TimeUnit.Days)
)
// Location on Finding (text), using the Room lookup
'Room'.'Room Code' & " - " & 'Room'.'Building'.'Building Name'Signe pointed out the second formula to Maribeth. It shows the building name on every finding without storing a copy: if facilities renames a building, every finding shows the new name immediately. That is the "denormalize without duplicating" idea from lesson 1.
Formula columns have limits that shape the design. Because they are computed when read, they cannot be the input of a prompt column, they are not audited (nothing is stored to audit), and very complex formulas over many related rows can slow views. They cannot aggregate many child rows; that is what rollups are for. Check the current list of supported functions in the Power Apps documentation before relying on one, because the list grows with releases.
Calculated columns
Calculated columns predate formula columns. You create a column of a chosen type, set its behavior to calculated, and open a designer where you write conditions (if the status is resolved) and actions (set the value to the difference between two dates), using a set of built-in functions such as DIFFINDAYS, ADDDAYS and CONCAT. Like formula columns, they are evaluated when the row is retrieved and can reference the same row and parent rows through lookups.
You will meet calculated columns in existing solutions and on exams, so you need to read and maintain them. For new work, a formula column usually does the same job more readably. Signe left one calculated column in place in Lumenvale's older asset solution because three reports depended on it, and wrote every new calculation as a formula column.
Condition: Resolved On contains data
Action: Days To Resolve = DIFFINDAYS(Found On, Resolved On)
Else: Days To Resolve = DIFFINDAYS(Found On, NOW())Rollup columns
A rollup column aggregates values from related rows into the parent row: the count of findings on an inspection, the sum of estimated repair costs, the earliest date found, the maximum priority. You define the source table (usually the current table), the related table reached through a one-to-many relationship (Finding), optional filters on the related rows (Result equals Fail and Status equals Open), and the aggregation: count, sum, minimum, maximum or average. For tables with a hierarchical relationship, a rollup can also include rows from the whole hierarchy below the row.
The key fact about rollups is timing. Rollup values are not calculated every time a row is read. Dataverse calculates them with background system jobs: an initial job after the column is created, and then a recurring job, every 12 hours by default, that an administrator can adjust. A user can recalculate one row's rollup on demand from the form, and developers can trigger a recalculation through the API. Between calculations the value can be out of date. The form shows when the rollup was last calculated.
Worked problem
Open failures on an inspection
Octavia wants each inspection to show the number of failed findings that are still open. Design the column.
Show solution
- The value aggregates many child rows, so it needs a rollup column on Inspection, not a formula column.
- Related table: Finding, through the Inspection to Finding relationship.
- Filter on related rows: Result equals Fail, and Status equals Open.
- Aggregation: Count of Finding.
- Timing: the value refreshes on the scheduled job; inspectors can recalculate on demand from the form when they close findings, and the inspection list shows the last calculated time.
Answer: A rollup column on Inspection counting Finding rows where Result is Fail and Status is Open, refreshed on schedule or on demand.
Rollups have other limits worth knowing. A table can have only a limited number of rollup columns, and an environment has an overall limit, so do not create them casually. A rollup cannot aggregate another rollup on the related table in the same way you might expect in a spreadsheet, and complex filters cost processing time in the background job. When a value must be exactly current at every moment, such as a count used to block closing an inspection, check it in a business rule, a flow or a plug-in at the moment of the action rather than relying on a rollup.
Choosing between them
| Question | Formula column | Calculated column | Rollup column |
|---|---|---|---|
| Uses values from the same row? | Yes | Yes | No, it aggregates related rows |
| Uses a parent row through a lookup? | Yes | Yes | Not its purpose |
| Aggregates child rows? | No | No | Yes: count, sum, min, max, average |
| Always current when read? | Yes | Yes | No: current as of the last job or recalculation |
| Preferred for new work? | Yes, for row-level calculations | No; maintain existing ones | Yes, for aggregates |
A useful pattern combines them. A rollup on Inspection counts open failures. A formula column on Inspection then turns that count into a label: "No open failures", "1 open failure" or "5 open failures, oldest 23 days", using a second rollup for the earliest date found. The rollup does the aggregation; the formula does the presentation.
Prompt columns
A prompt column stores text generated by an AI model from a prompt you write and the values of input columns in the same row. Lumenvale's inspectors write notes in a hurry: "Eyewash flow weak, bowl dirty, cover missing, last tag Aug". A prompt column called Plain Summary can turn that into a consistent sentence for the trades crew and a priority suggestion for the supervisor, using the note, the checklist item and the room type as inputs.
You create a prompt column like other columns, choosing Prompt as the data type and then adding a prompt with its input columns. A few verified details matter for design and for the exam. A table can have up to five prompt columns. The prompt runs asynchronously when a row is created or when one of its referenced input columns changes; it does not run if none of them changed, and editing the prompt does not regenerate existing values until an input changes. Each prompt column gets two companion columns that record its status (not started, in progress, completed, skipped or failed) and details such as the last run time or the error. Formula, file, image and other prompt columns cannot be inputs.
| Design point | What to know |
|---|---|
| Credits | Prompt columns consume AI credits, so estimate volume before turning them on for a busy table |
| Settings | Copilot and AI prompt features must be on for the environment, and execution can be turned off per column |
| Existing rows | Back-filling existing rows needs an environment setting that is off by default, and runs as a system job |
| Permissions | If the user lacks access to an input column, the generation fails; check the status column |
| Auditing | Prompt column values are not audited |
| Review | Generated text is a draft; keep the original note and let people correct the summary |
Signe set the prompt's instructions carefully: summarize the inspector's note in one sentence, never invent a measurement or a date that is not in the note, and say "No note" if the note is empty. She tested it on 30 real notes from the old spreadsheet before turning it on, and the supervisors agreed that the summary is a helper, not the record; the inspector's original note stays on the finding.
Row summaries
A row summary is related but different. Instead of storing generated text in a column, it shows a Copilot-generated summary of a row at the top of model-driven forms and from views, built from a prompt that lists which columns to include and how to format the result. A maker configures it once for the table, in the table's customizations, tests the prompt and applies it to the table's main forms, and the summary then appears for that table's forms and views. An administrator must have turned on row summaries in the Copilot settings of the Power Platform admin center.
Row summaries have documented limits: they are not designed for arithmetic or date calculations, and some kinds of columns, such as formula columns, choice labels and related rows, may not be interpreted reliably. So Signe uses each tool for what it is good at. Days Open is a formula column, because it is arithmetic. Open Failures is a rollup, because it aggregates. The row summary on Inspection tells a supervisor in two sentences what the inspection found, using the inspector, the building, the counts and the notes.
Testing calculations
Every calculated value needs test data that exercises its edges. For Days Open, Signe created findings found today, found last year, resolved on the same day and never resolved. For the rollup, she created an inspection with no findings, one with only passes, and one with open and closed failures, then ran the recalculation and compared the result with a manual count. For the prompt column, she checked the status column of every test row and read every summary. "If you can't say what the right answer is," she told Maribeth, "you haven't tested it."
Common mistakes
MistakeUsing a formula or calculated column to count child rows.
InsteadUse a rollup column for aggregates over related rows.
MistakeAssuming a rollup value is always current.
InsteadRollups refresh on a schedule or on demand; check the last calculated time or validate at the moment of an action.
MistakeWriting new calculations as classic calculated columns.
InsteadUse formula columns for new row-level calculations and maintain existing calculated columns.
MistakeUsing a row summary or prompt column for arithmetic.
InsteadDo calculations with formula and rollup columns; use AI for readable text.
MistakeTurning on a prompt column for a busy table without estimating credits.
InsteadEstimate volume, test on sample rows and monitor consumption first.
Summary and key terms
- Formula columns use Power Fx and are evaluated when the row is read; Microsoft recommends them for new row-level calculations.
- Calculated columns use a conditions-and-actions designer and are also evaluated when read; maintain them in existing solutions.
- Rollup columns count, sum, average, or find the minimum or maximum of related rows, refreshed by scheduled jobs or on demand.
- Prompt columns store AI-generated text from input columns, run asynchronously when inputs change, and have status and details companion columns.
- Row summaries show a Copilot summary of a row on forms and views and are not meant for arithmetic.
- Combine tools: rollups aggregate, formulas present, AI summarizes.
- Formula column
- A column whose value is calculated from a Power Fx formula when the row is read.
- Calculated column
- A classic column type that computes its value from conditions and actions when the row is read.
- Rollup column
- A column that aggregates values from related rows, updated by background jobs or on demand.
- Prompt column
- A column that stores text generated by an AI model from a prompt and input columns.
- Row summary
- A Copilot-generated summary of a row shown on model-driven forms and views.
- Aggregation
- A calculation over many rows, such as a count, sum, average, minimum or maximum.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Which column type should count the failed findings on an inspection?
Show answer
A rollup column with a filter on Result equals Fail.
Why might a rollup show 4 when there are really 7 open failures?
Show answer
The rollup has not been recalculated since findings were added; it refreshes on a schedule or on demand.
Give one input a prompt column cannot use.
Show answer
Any of: a formula column, a file column, an image column, another prompt column.
Why is Days Open better as a formula column than as a row summary?
Show answer
It is arithmetic, which formula columns compute exactly; row summaries are not designed for calculations.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.