# Year-To-Date value with Power BI and DAX

How to calculate a year-to-date value of the sales in DAX with Power BI? Also called YTD, it represents the total to date of a given measure. For example, to calculate the year-to-date sales total with a DAX formula, use the built-in function called TOTALYTD.

From this example, easily copy and paste the code and adjust it to the data analysis and reporting requirements.

## Calculate the sales Year-To-Date value of sales with Power BI

Indeed, this example calculates the YTD total of the sales amount using a simple DAX function. The TOTALYTD() DAX function uses a time dimension. To do this, flag one dimension as time.

`YTD Sales := TOTALYTD(SUM('ShopSales'[SalesAmount]),'Time'[DateKey]) `

Also, to go further and get some more insights on DAX functions, check out the Microsoft Power BI website.

This short article explains how to calculate the year-to-date number of sales for the selected fiscal year or calendar year.

Check the previous article on how to calculate the last year value in DAX.

What does YTD stand for ?

YTD abbreviation stands for Year-To-Date or year-to-date, it’s a financial calculation based on time. It usually uses a fiscal calendar to calculate the sales or revenue from the first month of the year till the current month. Or the first day to the current date.

What is a Year-To-Date value ?

A Year-To-Date value is a calculation that sums up all the data from the first month of a given year till the currently selected month.

What’s the difference between a YTD and a YTG value ?

YTD stands for Year-To-Date and YTG stands for Year-To-Go, both are cumulative time calculations, the first is from the first month till the current one. The second one is from the next month till the end of the year. YTD + YTG = Full Year.

How to use the TOTALYTD function in DAX ?

To use the built-in TOTALYTD DAX function in Power BI, create a formula. For example for sales year-to-date values: YTD Sales := TOTALYTD(SUM(‘ShopSales'[SalesAmount]),’Time'[DateKey])

This related article explains what DAX abbreviation means and how the language is used in Microsoft tools.