How to Calculate Current Year Sales in Power BI

Cody Schneider••8 min read

Tracking your current year's sales might sound like a simple task, but if you're using Power BI, you know it's not always as easy as just dragging a field onto a chart. To build a truly dynamic report that automatically updates as the year progresses - and rolls over flawlessly on January 1st - you need to get comfortable with a bit of DAX. This article will guide you step-by-step through creating a reliable and reusable measure for calculating your current year sales in Power BI.

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 Not Just Use a Filter?

Your first instinct might be to simply drag the "Year" from your date field into the filter pane and select the current year. While that works in the short term, it creates two major problems:

  • It's a manual process. As soon as the clock strikes midnight on New Year's Eve, your report becomes outdated. You'll have to remember to go in and manually change the filter to the new year. This is easy to forget and clutters your workflow.
  • It limits your analysis. Filtering the entire report page to the current year makes it incredibly difficult to do year-over-year comparisons. You can't show "this year's sales vs. last year's sales" if last year's data has been completely filtered out.

A DAX measure, on the other hand, is dynamic. You write it once, and it always knows what the "current year" is, allowing you to build set-it-and-forget-it dashboards that are always up to date. It also allows you to use your current year sales figure alongside other time periods, like the previous year, in the same chart.

Step 1: Get Your Data Model Ready with a Date Table

Before writing any time-based DAX formulas, you absolutely need a dedicated Date Table in your data model. A Date Table is a simple table containing a continuous list of dates, along with helpful columns like Year, Quarter, Month, and Day of the Week. Time intelligence functions in DAX rely on this unbroken sequence of dates to work correctly.

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.

What is a Date Table and Why Do I Need One?

Think of a Date Table as the calendar your Power BI report uses to understand time. Without it, DAX functions like SAMEPERIODLASTYEAR or DATESYTD can produce strange or incorrect results. Your sales data might have gaps (e.g., no sales on a Sunday), but the Date Table ensures Power BI has a full calendar to reference.

You can create a Date Table in a few ways, but here are two common methods:

Method A: Create a Date Table with DAX

If you're already in Power BI Desktop, the quickest way to create a basic Date Table is with a DAX calculated table.

  1. Go to the Data view on the left-hand side.
  2. In the top ribbon, click on New Table.
  3. Enter the following DAX formula. This will create a calendar that automatically spans the dates found in your sales table.
Date = 
ADDCOLUMNS(
    CALENDARAUTO(),
    "Year", YEAR([Date]),
    "Month", FORMAT([Date], "mmmm"),
    "MonthNumber", MONTH([Date]),
    "Quarter", "Q" & FORMAT([Date], "q")
)

Method B: Use Power Query

You can also create a more robust Date Table in the Power Query Editor. This is a great option if you need to add custom columns like fiscal year information or week numbers. While we won't cover the full process here, it's a powerful alternative to investigate.

Establishing the Relationship

Once you have your Date Table, you need to connect it to your sales data.

  1. Go to the Model view.
  2. Find your new 'Date' table and your 'Sales' (or 'Orders,' 'Transactions,' etc.) table.
  3. Click and drag the date column from your 'Date' table and drop it onto the corresponding date column in your 'Sales' table (e.g., 'OrderDate').

Power BI will create a one-to-many relationship, which is the foundation for our next steps.

Step 2: Create a [Total Sales] Base Measure

Before we calculate current year sales, we first need a simple measure that calculates all sales. This is a best practice in DAX. Creating simple, reusable "base" measures makes your more complex formulas cleaner and easier to manage later.

  1. Right-click on your Sales table in the Fields pane.
  2. Select New Measure.
  3. In the formula bar, enter this simple formula (replace 'Revenue' with your actual sales or amount column name):
Total Sales = SUM('Sales'[Revenue])

Hit enter. You won't see anything happen yet, but you've just created a building block we'll use in the next steps.

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

Step 3: Calculate Current Year Sales Using DAX

Now for the main event. We are going to create a measure that isolates only the sales from the current calendar year. We'll explore two great ways to do this depending on your needs.

Method 1: Year-to-Date Performance with TOTALYTD

Often, when people say "current year sales," they mean "year-to-date" sales. The TOTALYTD function is perfect for this. It calculates the cumulative total of a measure from the start of the current year up to the latest date present in your data.

  1. Right-click your Sales table and select New Measure again.
  2. Enter this DAX formula:
YTD Sales = TOTALYTD([Total Sales], 'Date'[Date])

Let's break that down:

  • TOTALYTD(...): This is the Year-to-Date function.
  • [Total Sales]: This is the base measure we want to calculate. We're telling DAX to get the cumulative sum of our total sales.
  • 'Date'[Date]: This is the primary date column from our dedicated Date Table. The function needs this to know what 'year' it's working with.

This measure is fantastic because it's completely dynamic. In January, it will only show January sales. By March, it will show the sum of January, February, and March sales. And next year, it will automatically reset.

Method 2: Full Year Total Sales with CALCULATE

What if you want to see the total sales for the entire year, even if it's only March? Or what if you want to explicitly check if a sale happened in the current calendar year? For this, we can use the most powerful function in DAX: CALCULATE.

  1. Create another New Measure.
  2. Use the following formula:
CY Sales = 
CALCULATE(
    [Total Sales],
    FILTER(
        'Date',
        'Date'[Year] = YEAR(TODAY())
    )
)

This looks a bit more intimidating, but it's doing something very straightforward:

  • CALCULATE(...): This function modifies the context of a calculation. Think of it as saying, "Calculate this for me, but apply this special filter first."
  • [Total Sales]: Again, our base measure.
  • FILTER(...): This is the special condition we're applying.
  • 'Date'[Year] = YEAR(TODAY()): This is the logic. It tells Power BI to only include rows where the 'Year' column in our Date Table is equal to the year of whatever today's date is. TODAY() always returns the current date from your system.

Step 4: Visualize Your New Measure

Now that you've done the hard work, it's time for the payoff! Let's see your new measures in action.

Drag a Card visual onto your report canvas. In the Fields well, add your new YTD Sales or CY Sales measure. You'll instantly see a clean, single number showing your current year's performance.

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.

Go Further: Create a YTD Performance Chart

To see how your sales are progressing this year, create a line chart:

  1. Add a Line chart visual to your report.
  2. Drag 'Date'[Month] to the X-axis.
  3. Drag your [YTD Sales] measure to the Y-axis.

You now have a beautiful cumulative sales chart that will automatically grow as the year goes on!

Pro Tip: Add Last Year's Sales for Comparison

The real power of DAX measures is the ability to do comparisons easily. Now that you have this year's sales, adding last year's is unbelievably simple.

  1. Create one more New Measure.
  2. Use the SAMEPERIODLASTYEAR function:
PYTD Sales = 
CALCULATE(
    [YTD Sales],
    SAMEPERIODLASTYEAR('Date'[Date])
)

This nifty function acts like a time machine, shifting the date context back by exactly one year.

Now, go back to your line chart and drag this new [PYTD Sales] measure into the Y-axis alongside your [YTD Sales]. You now have a powerful Year-over-Year comparison chart that will work forever without you touching it again.

Final Thoughts

You've now moved beyond basic drag-and-drop reporting into the world of dynamic, automated dashboards. By leveraging a DAX measure instead of a simple filter, you've created a calculation for current year sales that is both reliable and reusable, allowing for powerful comparisons that give you real business insight.

While mastering DAX in Power BI is a valuable skill, it often requires navigating a steep learning curve of functions and data models just to answer key questions. We created Graphed to remove that complexity entirely. We help you connect your data sources in seconds and then ask for what you need in plain English - like "Show me a chart of my year-to-date sales compared to last year." We build the real-time dashboard for you instantly, so you can focus on making decisions, not debugging formulas.

Related Articles