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:

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 here.

**Additional Resources**

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

How to Calculate a Cumulative Sum in Power BI

How to Calculate Cumulative Sum by Category in Power BI

How to Create a Cumulative Line Chart in Power BI