Analyzing and Visualizing Data with Microsoft Power BI — Question 25
You have a Power BI model for sales data. You create a measure to calculate the year-to-date sales.
You need to compare the year-to-date sales with the previous year for the same time period.
Which DAX function should you use?
Answer options
- A. DATEADD
- B. TOTALYTD
- C. DATESYTD
- D. ENDOFYEAR
Correct answer: C
Explanation
The correct answer is C, DATESYTD, because it allows you to retrieve the dates that fall within the year-to-date period, enabling comparisons with previous years. A, DATEADD, is used for shifting dates but not specifically for year-to-date calculations. B, TOTALYTD, aggregates values for the year to date but does not facilitate direct comparison with previous years. D, ENDOFYEAR, returns the last date of the year and is not suited for year-to-date comparisons.