Search Our Knowledge Base…

Search Our Knowledge Base…

DAX Functions

How to Create YTD Calculations in Power BI​ (2025)

How to Create YTD Calculations in Power BI​ (2025)

Learn how to calculate year-to-date (YTD) metrics in Power BI using DAX. Step-by-step examples to improve your time intelligence reporting.

Learn how to calculate year-to-date (YTD) metrics in Power BI using DAX. Step-by-step examples to improve your time intelligence reporting.

Verfasst von: Sajagan Thirugnanam and Austin Levine

Zuletzt aktualisiert am 23. Dezember 2025

In the world of data analysis and business intelligence, tracking performance over time is very important. One common way to do this is by using Year-to-Date (YTD) calculations. YTD calculations help us understand how the business is performing compared to the start of the year. Power BI makes it relatively straightforward to create YTD calculations, providing valuable insights through such capabilities.

I am sure you have struggled when trying to write a YTD function from scratch and this is mainly because of the different types of variations of the YTD Calculation in Power BI.

Don’t worry! In today’s article we will go through all the different ways we can use the YTD function to calculate year to date numbers and use this data point in your next report.

What is YTD Calculation?

Before diving into details, it’s essential to understand what YTD calculations entail. 

YTD stands for Year-to-Date, which is a period starting from the beginning of the current year (January 1) and ending at the current date. YTD calculations aggregate data from the start of the year up to a specified date. For instance, if today is June 22, the YTD value will sum the data from January 1 to June 22. 

This is useful as it allows us to know how a specific business KPI or metric is doing this running year and compare with the same period last year and calculate the percentage up or down year on year. 

This is a crucial method in which companies across the globe keep track of their performance and monitor KPIs. 

How to Use TotalYTD DAX Function in Power BI

Using the TotalYTD function is the easiest and fastest way to calculate a YTD total in Power BI. There are mainly two parameters involved - the data you want to calculate and the date column to be used. 

Here is how the syntax works: 

TOTALYTD (
    expression,
    [dates],
    filters, (optional)
    year_end_date, (optional)
)

Expression: an aggregation of a field such as Sum, SumX, Calculate etc

Dates: the date column that will be used to determine the year to date period

Filters: the filter field allows us to filter out the data for a specific criterion

Year ending date: the default year ending date is 12/31 but if needed we can change the fiscal year date to other dates using “mm/dd” quotation

Here is a simple example of how this function works. Let’s say we want to sum the total revenue of our company  year to date. For this we can use the TotalYTD function as such:

TOTALYTD (
    SUM ( Orders[Revenue] ),
    Orders[Date]
)

Now let’s say we want to see the total revenue till year only for sales of Product Type C. For this we can filter out data for the specific product type as such:

TOTALYTD (
    SUM ( Orders[Revenue] ),
    Orders[Date],
    Orders[Product_Type] = "C"
)

How To Calculate Previous Year’s Total?

Power BI has a built-in function that allows us to calculate the previous year’s totals in the same manner using the TotalYTD function. For this we can use the SAMEPERIODLASTYEAR function. 

Here is how it works:

TOTALYTD (
    SUM ( Orders[Revenue] ),
    SAMEPERIODLASTYEAR ( Orders[Date] )
)

This function looks very similar to the TotalYTD function we saw in the previous section. The only difference is that the date field is wrapped around the SAMEPERIODLASTYEAR function. 

However, it is important to note that this approach only works when we do not have any future data within the dataset. In the case we do have future data, we have to combine this approach with the calculate function which I have talked about in detail in my other blog here.

Other Methods for YTD Calculations

Using DATESYTD Function

You can use the DATESYTD function along with the calculate function to calculate YTD numbers. For example:

YTD Revenue =
CALCULATE (
    SUM ( Sales[Revenue] ),
    DATESYTD ( Date )
)

Using Calculate With Filter Option

Calculate function can be combined with a date filter to make it a more robust YTD calculation as such:

YTD Revenue =
CALCULATE (
    SUM ( Sales[Revenue] ),
    FILTER (
        ALL ( 'Date' ),
        'Date'[Date] <= MAX ( 'Date'[Date] )
            && YEAR ( 'Date'[Date] )
                = YEAR (
                    MAX ( 'Date'[Date] )
                )
    )
)

Here we are filtering up to the current date within the same year.

Best Practices for Using The YTD Calculations

While calculating YTD data, we must ensure that we have a date table which is connected to the fact table to create a relationship between the two. Remember that this table should include continuous dates and other necessary date related columns. 

Moreover, the relationship needs to be set up correctly in the data model. Finally, please don't forget to validate and double-check the accuracy of the YTD calculations by comparing them with known values.

Applying YTD in Visualizations and Reports

Once YTD measures are created, the next step is to apply them effectively in Power BI visualizations and reports to drive meaningful insights. YTD calculations are especially powerful when used in trend analysis, KPI tracking, and period-over-period comparisons.

A common use case is displaying YTD metrics in card visuals to show the current year’s performance at a glance. For example, a “YTD Revenue” card allows stakeholders to instantly understand how the business is performing up to the current date without needing additional filters.

YTD measures are also frequently used in line and area charts to visualize performance over time. When plotted against a date axis, YTD values help highlight growth patterns, seasonality, and acceleration or slowdown in performance throughout the year. This is particularly useful for monitoring sales, expenses, or operational KPIs on a monthly or daily basis.

Another effective scenario is comparing YTD vs Previous Year YTD using clustered column charts or tables. By placing both measures side by side, users can quickly assess year-over-year performance and identify trends or anomalies. Adding percentage difference measures further enhances the analytical value of these visuals.

To implement YTD measures in visuals:

  • Add the YTD measure to the Values field of the chosen visual.

  • Use a proper date hierarchy or date column on the axis or rows.

  • Apply slicers for year, month, or other dimensions to allow interactive analysis.

  • Ensure visuals are based on the date table rather than fact table dates for consistent results.

By integrating YTD measures into well-designed visuals, Power BI reports become more intuitive, interactive, and impactful, enabling users to track performance and make data-driven decisions with confidence.

Conclusion

Creating a YTD calculation in Power BI is a powerful way to gain insights into your business performance throughout the year without having to do it manually every single time. By following the steps and formulas mentioned in this article, you can easily perform the calculations which can aid you in making data driven decisions. 

Finally, as you have seen, there are many different ways to perform these YTD calculations in Power BI and it is always a good idea to know them all. You might find specific use cases for some of the other methods mentioned here. 

Hopefully, this article has given you a basic understanding of the YTD calculations in Power BI and can help you achieve proficiency in these functions when creating your next Power BI report

FAQs

What is YTD in DAX?

YTD calculations help us understand how the business is performing compared to the same period of last year. Power BI makes it relatively straightforward to create YTD calculations using DAX, providing valuable insights through such capabilities.

What is the YTD calculation?

YTD or Year To Date calculations are basically calculating a specific value or metric up to a certain time period in the running year.

Want Power BI expertise in-house?

Get in Touch With Us

Turn your team into Power BI pros and establish reliable, company-wide reporting.

Berlin, DE

powerbi@casewhen.co

Follow us on

Want Power BI expertise in-house?

Get in Touch With Us

Turn your team into Power BI pros and establish reliable, company-wide reporting.

Berlin, DE

powerbi@casewhen.co

Follow us on

Want Power BI expertise in-house?

Get in Touch With Us

Turn your team into Power BI pros and establish reliable, company-wide reporting.

Berlin, DE

powerbi@casewhen.co

Follow us on

© 2025 CaseWhen Consulting

© 2025 CaseWhen Consulting

© 2025 CaseWhen Consulting