PL-300 · Question #83
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…
The correct answer is C. DATESYTD. DATESYTD returns a table of dates from the start of the year to the current date in context. To compare the current YTD with the prior year's equivalent period, you use CALCULATE with DATESYTD wrapped around DATEADD (e.g., CALCULATE([Sales], DATESYTD(DATEADD(Date[Date], -1…
Question
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?
Options
- ADATEADD
- BTOTALYTD
- CDATESYTD
- DENDOFYEAR
How the community answered
(45 responses)- A7% (3)
- B13% (6)
- C76% (34)
- D4% (2)
Explanation
DATESYTD returns a table of dates from the start of the year to the current date in context. To compare the current YTD with the prior year's equivalent period, you use CALCULATE with DATESYTD wrapped around DATEADD (e.g., CALCULATE([Sales], DATESYTD(DATEADD(Date[Date], -1, YEAR)))). TOTALYTD aggregates a value over YTD but does not shift the period. DATEADD alone shifts dates but doesn't constrain to YTD. ENDOFYEAR simply returns the last date of the year.
Topics
Community Discussion
No community discussion yet for this question.