Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Solved! Go to Solution.
Hi @Rsing ,
DATESYTD and TOTALYTD are both DAX time intelligence functions in Power BI.
Common points:
1.can be used to calculate the year-to-date totals for a given metric. Specifically refer to the following format and link:
DATESYTD(<dates> [,<year_end_date>])
DATESYTD function (DAX) - DAX | Microsoft Learn
TOTALYTD(<expression>,<dates>[,<filter>][,<year_end_date>])
TOTALYTD function (DAX) - DAX | Microsoft Learn
2.There is an optional parameter <year_end_date>, if the value of this parameter is filled in "06/30", it means that the start of the calculation is July 1 of the current year, you can refer to the following link:
Different points:
1.The return value of DATESYTD is a table that contains a column of dates for that year-to-date in the current context.
TOTALYTD calculates the current calculation of the value of the expression in the context of the year-to-date value, return scalar results.
2.TOTALYTD can only add a filter, but DATESYTD and CALCULAT can be added in combination with a number of filter conditions, so DATESYTD more flexible than TOTALYTD. Although it is possible to add more than one filter using TotalYTD, it may make the expression a bit complicated, please refer to the following link for details:
The hidden secrets of TOTALYTD - SQLBI
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Rsing ,
DATESYTD and TOTALYTD are both DAX time intelligence functions in Power BI.
Common points:
1.can be used to calculate the year-to-date totals for a given metric. Specifically refer to the following format and link:
DATESYTD(<dates> [,<year_end_date>])
DATESYTD function (DAX) - DAX | Microsoft Learn
TOTALYTD(<expression>,<dates>[,<filter>][,<year_end_date>])
TOTALYTD function (DAX) - DAX | Microsoft Learn
2.There is an optional parameter <year_end_date>, if the value of this parameter is filled in "06/30", it means that the start of the calculation is July 1 of the current year, you can refer to the following link:
Different points:
1.The return value of DATESYTD is a table that contains a column of dates for that year-to-date in the current context.
TOTALYTD calculates the current calculation of the value of the expression in the context of the year-to-date value, return scalar results.
2.TOTALYTD can only add a filter, but DATESYTD and CALCULAT can be added in combination with a number of filter conditions, so DATESYTD more flexible than TOTALYTD. Although it is possible to add more than one filter using TotalYTD, it may make the expression a bit complicated, please refer to the following link for details:
The hidden secrets of TOTALYTD - SQLBI
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Rsing
They are both time intelligence functions that rely on a well-formed date table.
These 2 measures return the same result.
YTD Sales =
CALCULATE(
[Sales],
DATESYTD( 'Date'[Date] )
)
YTD Sales 2 =
TOTALYTD(
[Sales],
'Date'[Date]
)
Let me know if you have any questions.
User | Count |
---|---|
25 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
25 | |
12 | |
11 | |
10 | |
6 |