How to Calculate Rolling 12 Months in Power BI

Cody Schneider7 min read

Calculating a rolling 12-month total is one of the most useful metrics you can create in Power BI. It helps you smooth out seasonal bumps and dips in your data, giving you a clearer view of underlying trends. This article will show you exactly how to calculate this metric using DAX and avoid the common traps along the way.

Why Bother with a Rolling 12-Month Calculation?

Before jumping into the formulas, it’s helpful to understand why this metric, also known as a Trailing Twelve Months (TTM) calculation, is so valuable. Imagine you run an e-commerce store that sees a huge spike in sales every November and December, followed by a quiet January.

If you compare January sales to a record-breaking December, your performance will look terrible. But that comparison is misleading. A rolling 12-month total averages out these highs and lows. Instead of looking at a single month in isolation, it calculates the total for the most recent 12-month period. For example, the value for June 2024 would be the sum of all sales from July 2023 through June 2024. This method provides a much more stable and realistic view of your business's long-term health and growth trajectory.

You can use it to track nearly any key performance indicator (KPI), including:

  • Total revenue or profit
  • New customers acquired
  • Website sessions
  • Completed support tickets

The Foundation: A Proper Date Table

In Power BI, time intelligence functions rely entirely on one thing: a solid date table. Trying to perform time-based calculations without one is a recipe for frustration and incorrect results. Your date table is the backbone of your analysis.

What is a Date Table?

A date table is a simple table in your data model that contains a continuous sequence of dates - one row for every single day within a period (e.g., from January 1, 2020, to December 31, 2025). It cannot have any gaps. You'll link this table to the date columns in your other data tables, like your Sales or Orders table.

How to Create and Configure a Date Table

If your data warehouse doesn’t already provide a date dimension table, you can create one directly in Power BI with a simple DAX formula.

  1. In the report view, navigate to the Modeling tab and click New Table.
  2. Enter the following DAX formula. You can adjust the start and end dates to fit your data:

Date Table = CALENDAR(DATE(2022, 1, 1), DATE(2025, 12, 31))

After creating the table, you need to tell Power BI that this is a special table meant for date calculations.

  • With the new Date Table selected, go to the Table tools ribbon and click Mark as date table.
  • In the dialog box, select the date column (it will likely be named [Date]) and click OK. A small calendar icon will appear next to the column name, confirming it's set up correctly.

Finally, go to the Model view in Power BI and create a relationship. Drag the Date column from your newly created Date Table and drop it onto the corresponding date column in your data table (like Sales[OrderDate]). This one-to-many relationship enables all the powerful DAX time intelligence functions.

Creating the Rolling 12-Month Measure in DAX

With your date table in place, you’re ready to write the DAX formula. We’ll break this down into two simple steps: creating a base measure and then the rolling 12-month calculation that builds on it.

Step 1: Create a Base Measure

A best practice in DAX is to always create explicit measures for your core calculations instead of relying on Power BI's implicit measures (like dragging a column directly into a chart). Let’s create a simple measure to sum up sales revenue.

  1. Right-click on your Sales table (or whichever table holds the data you want to total) and select New Measure.
  2. Enter the following formula:

Total Revenue = SUM(Sales[Revenue])

This gives us a clean, reusable measure for our total revenue.

Step 2: Calculate the Rolling 12-Month Total

Now we’ll create the main measure. We’ll use CALCULATE to modify the filter context and a versatile time intelligence function called DATESINPERIOD.

  1. Right-click your Sales table again and select New Measure.
  2. Enter this DAX formula:

Revenue R12M = CALCULATE( [Total Revenue], DATESINPERIOD( 'Date Table'[Date], LASTDATE('Date Table'[Date]), -12, MONTH ) )

Breaking Down the Formula

Let's look at what each part of this formula does:

  • CALCULATE([Total Revenue], ...): This is the workhorse of DAX. It tells Power BI to calculate our [Total Revenue] measure, but with a modified filter. The second part of the formula defines that new filter.
  • DATESINPERIOD(...): This function returns a table containing a single column of dates. We are telling it exactly which 12-month period to use.

In plain English, the formula says: "Calculate the total revenue for the period starting 12 months before the last date in the current filter context and ending on the last date in the current filter context."

Visualizing Your Rolling 12-Month Trend

Now for the fun part! Let’s put our new measure to use.

A line chart is the perfect way to visualize a rolling trend.

  1. Add a Line chart visual to your Power BI report canvas.
  2. Drag the Date column from your Date Table onto the X-axis field.
  3. Drag your new [Revenue R12M] measure onto the Y-axis field.
  4. (Optional) For comparison, also drag your original [Total Revenue] measure onto the Y-axis.

You should instantly see an amazing result. While your [Total Revenue] line might be spiky and volatile, jumping up and down with seasonality, the [Revenue R12M] line will be much smoother, clearly revealing the underlying momentum of your business.

Common Problems and How to Fix Them

If your calculation isn't working as expected, it's almost always due to one of a few common setup issues. Here’s what to check.

Problem: My measure returns a blank value or the same total for every month

  • Check your Date Table: Ensure you have marked your date table officially using the "Mark as date table" feature. This is the most common reason time intelligence functions fail.
  • Check Relationships: Confirm in the Model view that there is an active, one-to-many relationship between your date table and your data table.
  • Check for Gaps: Your date table MUST be a continuous sequence of days. Missing dates will break the calculations. Recreate it with the CALENDAR function if you're unsure.

Problem: The calculation seems to reset or stop at the end of a calendar year

  • This can happen if your DAX logic isn't structured correctly. Functions like TOTALYTD are designed to reset each year. The DATESINPERIOD approach shown above, anchored by LASTDATE, is designed specifically to roll naturally across year-ends without resetting, making it perfect for this use case. Double-check that your formula matches the one provided.

Final Thoughts

Creating a rolling 12-month calculation is a fundamental skill in Power BI that transforms raw, noisy data into a clear long-term trend. By setting up a proper date table, writing a base measure, and using CALCULATE with DATESINPERIOD, you can quickly build powerful and insightful reports that tell a much clearer story about your business performance.

Mastering DAX is incredibly rewarding, but it often requires a lot of trial and error to get a measure just right. With Graphed, you can connect your data sources and get sophisticated analysis without writing a single line of DAX. Just ask, "Show me my rolling 12-month revenue trend as a line chart," and our AI data analyst builds a real-time, interactive dashboard for you in seconds. We handle the complex calculations so you can focus on the insights.

Related Articles

How to Connect Facebook to Google Data Studio: The Complete Guide for 2026

Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.

Appsflyer vs Mixpanel​: Complete 2026 Comparison Guide

The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.