How to calculate year to date value in DAX?

How to calculate the year to date value of the sales in DAX? To calculate the year-to-date value with a DAX formula, use the built-in function called TOTALYTD. In this example, simply copy paste the code and adjust it to your needs.

How to calculate the year to date value of sales in DAX?

Indeed, this example calculates the year to date value 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]) 

In this article we calculate the year to date amount of sales for the selected fiscal or calendar year. Check the previous article on how to calculate the last year value in DAX.

Be the first to comment

Leave a Reply