How can I calculate YTD (Year to Date) values in Power BI?

Calculating YTD (Year to Date) values in Power BI allows you to track the cumulative performance of your data from the beginning of the year up to the current date. This feature is useful for analyzing trends and making comparisons to previous years. To calculate YTD values in Power BI, you will need to create a measure that uses the TOTALYTD function, which sums the values from the specified date range. By using this function, you can easily visualize the progress of your data over time and make informed decisions based on the YTD results.

Calculate YTD (Year to Date) Values in Power BI


The easiest way to calculate year to date values in Power BI is to use the TOTALYTD function in DAX.

For example, you can use the following syntax in DAX to create a new measure that calculates the sum of the year to date values in the Sales column of a table named my_data:

YTD Sales = TOTALYTD(SUM(my_data[Sales]), my_data[Date])

The following example shows how to use this syntax in practice.

Example: How to Calculate YTD (Year to Date) Values in Power BI

Suppose we have the following table in Power BI named my_data that contains information about sales made on various dates by some company:

Suppose we would like to create a measure that calculates the sum of the year to date values in the Sales column of a table.

To do so, click the Table tools tab along the top ribbon, then click the New measure icon:

Then type the following formula into the formula bar:

YTD Sales = TOTALYTD(SUM(my_data[Sales]), my_data[Date])

This will create a new measure named YTD Sales that contains the sum of the year to date values in the Sales column of the table.

We can then click the Report View icon on the left side of the screen:

Then we can click the Table icon under the Visualizations tab and drag Date, Sales and YTD Sales under the Columns panel:

This will produce the following table that contains the Date, Sales and Year to Date Sales:

Power BI calculate YTD values

From the table, we can see:

  • Year to Date Sales up to 1/8/2024 is 10.
  • Year to Date Sales up to 1/10/2024 is 24.
  • Year to Date Sales up to 1/13/2024 is 54.

And so on.

Note: You can find the complete documentation for the TOTALTYD function in DAX .

Additional Resources

The following tutorials explain how to perform other common tasks in Power BI:

x