Calculate year-to-date value in DAX with Power BI

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.

How to calculate the year-to-date value of sales in DAX 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 Power BI website.

In this article, we calculate the year-to-date amount 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])

Be the first to comment

Leave a Reply

Your email address will not be published.