exam questions

Exam 70-778 All Questions

View all questions & answers for the 70-778 exam

Exam 70-778 topic 1 question 114 discussion

Actual exam question from Microsoft's 70-778
Question #: 114
Topic #: 1
[All 70-778 Questions]

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?

  • A. DATEADD
  • B. TOTALYTD
  • C. DATESYTD
  • D. ENDOFYEAR
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
References:
https://powerpivotpro.com/2016/01/year-to-date-in-previousprior-year/

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
exam_taker5
Highly Voted 5 years, 10 months ago
I believe this should be DateAdd, as you need to select the dates of this year minus one year.
upvoted 23 times
RoryHny
5 years, 9 months ago
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.
upvoted 3 times
Hien
5 years, 8 months ago
so the question should allow multiple choices.
upvoted 3 times
...
...
AkaChilala
5 years, 5 months ago
A is the correct answer. DATEYTD gives you the running total of the provided date. It does not give you the previous year, but using DATEADD does.
upvoted 4 times
coupet
5 years ago
A is correct. DATESYTD Returns a table that contains a column of the dates for the year to date, in the current context.
upvoted 1 times
...
...
...
JohnFan
Highly Voted 5 years, 5 months ago
The measure to calculate the year-to-date sales (DATESYTD(Calendar[Date])) has already been created.
upvoted 8 times
AnetaK
5 years, 5 months ago
So the answer is DATEADD.
upvoted 7 times
...
...
nemanjaandic
Most Recent 4 years, 2 months ago
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/
upvoted 1 times
...
CDL
4 years, 6 months ago
DateAdd or SamePeriodLastYear https://docs.microsoft.com/en-us/dax/dateadd-function-dax https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax https://docs.microsoft.com/en-us/dax/totalytd-function-dax https://docs.microsoft.com/en-us/dax/datesytd-function-dax
upvoted 3 times
...
shoei
4 years, 7 months ago
DateADD and SAMEPERIODLAST YEAR are same so DATEADD should be the answer. DATEYTD is to calculate running total.
upvoted 1 times
...
shoei
4 years, 8 months ago
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.
upvoted 1 times
...
gogetter
4 years, 9 months ago
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)
upvoted 1 times
gogetter
4 years, 9 months ago
Different and conflicting opinions are welcomed!
upvoted 1 times
...
...
123
4 years, 10 months ago
A. DATEADD
upvoted 1 times
...
DAX_learner
4 years, 10 months ago
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
upvoted 2 times
...
DAX_learner
4 years, 10 months ago
the requirement is YearToDate sale. For the YTD sales, filter is previous year. So my most related answer DatesYTD()
upvoted 1 times
...
Dirk
5 years, 2 months ago
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.
upvoted 2 times
...
calibear
5 years, 3 months ago
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))
upvoted 2 times
...
mohroshdy
5 years, 4 months ago
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.
upvoted 4 times
...
JohnFan
5 years, 5 months ago
[Prev Yr YTD Sales Trimmed]= CALCULATE([Total Sales], DATEADD( FILTER(DATESYTD(Calendar[Date]), Calendar[Date]<= LASTNONBLANK(Calendar[Date], [Total Sales]) ), -1,Year ) )
upvoted 1 times
...
Rufusinski
5 years, 5 months ago
Question assumes that Total YTD is created, so only DATEADD is needed to shift measure one year back.
upvoted 6 times
...
RBY10
5 years, 8 months ago
DATEADD and DATESYTD are both needed
upvoted 2 times
cs3122
5 years, 3 months ago
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
...
...
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.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago