How to Add Variance Column in Power BI Matrix

Cody Schneider••7 min read

Showing how key metrics change over time is one of the most powerful things you can do in a report. A Power BI matrix is perfect for this, but to make it truly insightful, you need to add variance columns that spell out the exact difference, both as a number and as a percentage. This tutorial will walk you through the practical, step-by-step process of using DAX to add absolute and percentage variance columns to your Power BI matrix.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Why Add a Variance Column in the First Place?

Before diving into the "how," let's quickly touch on the "why." A variance column transforms your data from a simple statement of fact into a story. Instead of just displaying this year's sales and last year's sales side-by-side, a variance column instantly answers critical business questions:

  • Are we growing or declining?
  • By how much did our lead volume change this month compared to last month?
  • Which products saw the biggest increase in sales year-over-year?
  • Is our marketing spend over or under budget for the quarter?

Adding variance provides immediate context. It tells you where to focus your attention by highlighting significant changes, saving you and your stakeholders the mental math of comparing numbers row by row. It’s a simple addition that adds a huge amount of analytical value.

Setting Up Your Data and Basic Matrix

To calculate variance, you need a clear baseline and comparison point. For this guide, we'll use a common scenario: comparing sales from the current year to the previous year. Our data model will be straightforward, containing:

  • A Sales table with columns like [OrderDate], [ProductName], and [Revenue].
  • A Calendar table with columns like [Date], [Year], and [Month]. The Date column is related to the [OrderDate] column in the Sales table.

Pro Tip: Using a dedicated Calendar table is a Power BI best practice. It provides a stable foundation for time intelligence functions, which we'll be using heavily.

First, create a basic Matrix visual.

  1. Select the Matrix visual from the Visualizations pane.
  2. Drag [ProductName] from your 'Sales' table to the Rows field.
  3. Drag [Year] from your 'Calendar' table to the Columns field.
  4. Drag [Revenue] from your 'Sales' table to the Values field.

You should now have a simple matrix showing the total revenue for each product, broken down by year. It’s useful, but it forces you to manually compare the numbers across the columns. Let’s fix that.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Calculating Key Measures with DAX

To build our variance columns, we need to create some calculations using DAX (Data Analysis Expressions). The key to keeping your DAX clean and manageable is to build your calculations in layers, starting with simple base measures.

Step 1: Create a Base Measure for Total Revenue

Instead of just dragging the 'Revenue' column into the values field, it’s always better to create an explicit measure. This makes your formulas reusable and easier to understand.

Go to the Modeling tab and select New Measure. Enter the following formula:

Total Revenue = SUM('_Sales'[Revenue])

Now, swap out the original 'Revenue' field in your matrix's Values section with this new [Total Revenue] measure. The matrix will look the same, but you now have a solid building block.

Step 2: Calculate Previous Year's Revenue

Next, we need a measure that calculates the revenue for the same period in the prior year. This is where DAX's time intelligence functions shine. Create another new measure:

PY Revenue = CALCULATE( [Total Revenue], SAMEPERIODLASTYEAR('Calendar'[Date]) )

Let’s break this down:

  • CALCULATE([Total Revenue], ...): This modifies the filter context of the calculation.
  • SAMEPERIODLASTYEAR('Calendar'[Date]): Shifts the current date context back by exactly one year.

Add the [PY Revenue] measure to your matrix's Values field. Now, for each year, you can see that year's sales and the previous year's sales right next to it.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Adding the Variance and Variance % Columns

With our core measures in place, calculating the variance is now simple subtraction and division.

Step 1: Create the Absolute Variance Measure

Absolute variance is the simple dollar-value difference between the two periods. Create a new measure:

Revenue Variance ($) = IF( NOT(ISBLANK([PY Revenue])), [Total Revenue] - [PY Revenue] )

We wrap our calculation in an IF statement. The NOT(ISBLANK([PY Revenue])) check ensures variance is only calculated when there is a previous year value. This prevents a value from appearing in the very first year of your data, making the report cleaner.

Step 2: Create the Variance Percentage Measure

The percentage variance shows the relative change and is often more insightful than the absolute number. Create another new measure:

Revenue Variance % = DIVIDE( [Revenue Variance ($)], [PY Revenue] )

Here’s why we use DIVIDE() instead of a slash (/):

  • The DIVIDE() function is safer. It handles division-by-zero errors gracefully. If [PY Revenue] is zero, it returns blank instead of an error.

Step 3: Format Your New Measures and Add Them to the Matrix

Your [Revenue Variance %] measure is currently a decimal. To make it more readable, select the measure in the Data pane, and in the Measure tools ribbon at the top, set the format to Percentage.

Now, drag [Revenue Variance ($)] and [Revenue Variance %] into the Values section of your matrix visual. Organize the fields to read logically: Total Revenue, PY Revenue, Revenue Variance ($), and Revenue Variance %.

You’ll notice that the matrix now has sub-columns under each year, which can clutter the view. To improve readability:

  • Go to the Format pane (paintbrush icon).
  • Expand Column headers.
  • Turn off Stepped layout.
  • Also, under Values, turn on Show on rows if you prefer fields displayed vertically.
  • Alternatively, position your [Year] field in the Columns area and the measures alongside for a clean side-by-side comparison.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Enhancing Your Matrix with Conditional Formatting

Your matrix is now fully functional, but we can make it more visually appealing by adding conditional formatting:

Coloring the Variance Percentage

  1. Select your matrix, open the Format pane, and expand Cell elements.
  2. In the dropdown, select [Revenue Variance %].
  3. Turn on Background color.
  4. Click the 'fx' button to open rules.
  5. Set Format style to Rules.
  6. Configure rules to color code the background based on value:
  • If value is greater than 0, color light green.
  • If value is equal to 0, color yellow.
  • If value is less than 0, color light red.

Click OK. The percentage cells will now reflect performance visually.

Adding Icons for Quick Recognition

  1. With [Revenue Variance %] selected in Cell elements, turn on Icons toggle and click 'fx'.
  2. Choose a style such as arrow icons or triangles.
  3. Set rules similar to the background coloring:
  • Upward arrow for positive (>0).
  • Dash or flat icon for zero (=0).
  • Downward arrow for negative (<0).

Click OK. Now, icons will visually indicate the direction of change at a glance.

Final Thoughts

By creating a few layered DAX measures, you've transformed a basic Power BI matrix into a powerful variance report. The key steps are establishing base measures, using time intelligence functions like SAMEPERIODLASTYEAR, calculating the difference and percentage change, and finally, using conditional formatting to bring the story in your data to life.

While this process involves learning DAX, creating multiple measures, and formatting visuals, it can be streamlined with tools. At Graphed, we’ve developed a tool that automates all this: no formulas needed. Simply ask for a table of your data, and our AI data analyst connects to your sources, computes everything behind the scenes, and generates the dashboard you need—without a steep learning curve.

Related Articles