Skip to main content
Version: Version 22

Visual Calculations

With visual calculations, you add calculated values to a Power BI visual, such as a remaining budget or a running total. A visual calculation is a DAX expression that works on the data already shown in the visual. You don't need to change the underlying data model.

You can use visual calculations in the dashboards of the Insights app and on the Dashboard tab of the Portfolio app. This article covers the basics and the most common pitfalls. It is not a full DAX reference. For that, see Visual calculations overview (Microsoft Learn).


Before you start​

  • You need edit rights on the dashboard.
  • Visual calculations work on tables, matrices and standard charts. They don't work on slicers, custom visuals, or AI visuals such as Key Influencers and Decomposition Tree.
tip

Before you make bigger changes, take a screenshot of the visual. That makes it easy to compare the result afterwards.


Add a visual calculation​

  1. Open the dashboard in edit mode.
  2. Right-click the visual and select New visual calculation.
  3. Choose a template, such as Running sum or Percent of grand total, or select Custom to write your own DAX expression.
  4. Check the result. The calculation appears as a new column or value in the visual.

Templates​

TemplateWhat it shows
Running sumA cumulative total across rows
Moving averageThe average over a sliding window
Percent of parentA value as a percentage of its parent group
Percent of grand totalA value as a percentage of the grand total
Versus previous / nextThe difference with the previous or next row

Rules for your own expressions​

  • A visual calculation can only use fields that are on the visual. Need a field you don't want to show? Add it to the visual and hide it.
  • Field names in square brackets must match the names in the visual exactly. Embedded dashboards have no autocomplete, so check the spelling.
  • The calculation works on the values the visual already shows. You usually don't need aggregation functions such as SUM.
  • Functions that depend on model relationships, such as RELATED, RELATEDTABLE and USERELATIONSHIP, are not available.

Examples​

Replace the field names with the names of the fields in your own visual.

What you want to showDAX expression
Remaining budgetRemaining budget = [Budget] - [Actual Costs]
Percentage of budget usedBudget used % = DIVIDE([Actual Costs], [Budget])
Cumulative hoursRunning total hours = RUNNINGSUM([Actual Hours])
Share of the grand totalShare of total = DIVIDE([Actual Hours], COLLAPSEALL([Actual Hours], ROWS))
Difference with the previous rowChange vs previous = [Actual Costs] - PREVIOUS([Actual Costs])
Status labelBudget status = IF([Actual Costs] > [Budget], "Over budget", "Within budget")

Formatting​

Number format​

  1. Select the visual calculation.
  2. In the formatting pane, go to General > Data format.
  3. Choose a format, or enter a custom format string:
    • #,##0 for whole numbers with a thousands separator.
    • #,##0.00 for two decimals.
    • 0.0% for a percentage with one decimal.

Formatting on the total row​

Formatting such as conditional formatting only applies to values by default. To apply it to the total row as well, open the formatting settings of the field and change Apply to from Values only to Values and totals.


Known limitations​

LimitationWhat it means
Items without data are hiddenShow items with no data is not available on a visual with a visual calculation. Need all items? Use a separate visual without a calculation.
No sorting, filtering or aggregation changeYou can't sort or filter a visual by a visual calculation, or change its aggregation.
Not in exportsWhen you export data from the visual, the results of the visual calculation are not included.
Not every field is supportedA field that is not compatible blocks the calculation. See Troubleshooting.

Troubleshooting​

The calculation can't be added or gives an error​

Most likely, the visual contains a field that does not work with visual calculations. To find it:

  1. Create a new table visual with only the fields your calculation needs.
  2. Add the visual calculation and check that it works.
  3. Add the other fields one by one. Check the result after each field.
  4. When the calculation stops working, the last field you added is the cause. Remove it or use another field.

Also check the spelling of the field names, and that the expression does not use RELATED, RELATEDTABLE or USERELATIONSHIP.

Items without data have disappeared​

This is expected. See Known limitations.

Formatting is missing on the total row​

Change Apply to to Values and totals. See Formatting on the total row.


Support​

Still stuck? Submit a ticket via the Support Center. See Fortes Customer Support. Include:

  • The app and the name of the dashboard.
  • The DAX expression you used.
  • What you expected and what you see instead.
  • A screenshot of the visual, without personal data.