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?
According to the reference link:
CALCULATE([Total Sales], DATEADD(DATESYTD(Calendar[Date]),-1,Year))
what happens in this formula is that the DATESYTD “runs” first, and “finds” the dates in the calendar starting from the beginning of the year up through the “max” date in the current filter context of the pivot. Then that range of dates is handed to DATEADD, which then “shifts” that range of dates back by one year.
Hard question to answer. It's not defined whether you already have created basic measure or not. But as it says "You create a measure..." so it means that it still doesn't exist.
On the other hand it says that "you need to compare .. with the previous year".
So actually these are 2 completely different measures.
First measure can be calculated using either TotalYtd or DatesYtd.
Second measure can be calculated using DateAdd.
As TotalYtd and DatesYtd have same results (DatesYtd requires Calculate as well, can't be standalone as it returns table), and they provide YTD, i would go with DateAdd as it has option to return previous year data. If DateAdd works it means that YTD is also correct (whenever it was created :) )
https://powerpivotpro.com/2016/01/year-to-date-in-previousprior-year/
Actually question is confusing. It is asking us to create Year to Date measure. it is not saying it already got Year to Date measure.
read the question again.
so option C is fine by me.
Be careful, the question states: you create a measure to calculate the year-to-date sales. (I guess that measure has already been created according to this context (DATEYTD), and now it asks that you need to compare the year-to-date sales with the previous year for the same time period. I think the question refers to the previous year (DATEADD) measure that we need to create. I understand this that DATEYTD has already been created and that we need to compare it now. (DATEADD)
Prevous Year YTD sales = TOTALYTD([Sum of Sales],DATEADD('Dimension Date'[Date],-12,MONTH))
Ytd sales in previous year = CALCULATE([Sum of Sales],DATESYTD(DATEADD('Dimension Date'[Date],-12,MONTH)))
both code successfully work for me
Actually the question is not about the complete DAX formula.
It only asks which function to use (does not tell us not to use any other function)
And DATESYTD deals with YTD functionality due to our question.
So I vote for the suggested solution C.
We cant get the desired result using only DATESYTD. When used together with DATEADD, we cant get the same period of the previous year, we can get the whole of the previous year.
Therefore, either SAMEPERIODLASTYEAR and DATESYTD or TOTALYTD and DATEADD should be used together.
_SAMEPERIODLASTYEAR = CALCULATE (SUM (Invoice [Price]); SAMEPERIODLASTYEAR (DATESYTD (Invoice [Date]))))
_TOTALYTD = TOTALYTD (SUM (Invoice [Price]); DATEADD (Invoice [Date]; - 1, YEAR))
A is the correct answer as you already created a measure to calculate the year-to-date sales and you need to compare it with the previous year so you just need DATEADD function.
Not true - If you have an existing measure for YTD sales already, then you only need DATEADD to get sales for the prior year.
upvoted 11 times
...
...
This section is not available anymore. Please use the main Exam Page.70-778 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
exam_taker5
Highly Voted 5 years, 10 months agoRoryHny
5 years, 9 months agoHien
5 years, 8 months agoAkaChilala
5 years, 5 months agocoupet
5 years agoJohnFan
Highly Voted 5 years, 5 months agoAnetaK
5 years, 5 months agonemanjaandic
Most Recent 4 years, 2 months agoCDL
4 years, 6 months agoshoei
4 years, 7 months agoshoei
4 years, 8 months agogogetter
4 years, 9 months agogogetter
4 years, 9 months ago123
4 years, 10 months agoDAX_learner
4 years, 10 months agoDAX_learner
4 years, 10 months agoDirk
5 years, 2 months agocalibear
5 years, 3 months agomohroshdy
5 years, 4 months agoJohnFan
5 years, 5 months agoRufusinski
5 years, 5 months agoRBY10
5 years, 8 months agocs3122
5 years, 3 months ago