exam questions

Exam 70-778 All Questions

View all questions & answers for the 70-778 exam

Exam 70-778 topic 2 question 11 discussion

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

You have a Power BI model for sales data.
You need to create a measure to calculate the year-to-date sales and to compare those sales to the previous year for the same time period.
Which DAX function should you use?

  • A. PARALLELPERIOD
  • B. SAMEPERIODLAST YEAR
  • C. DATESYTD
  • D. PREVIOUSYEAR
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
References: https://msdn.microsoft.com/en-us/library/ee634873.aspx

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
twane
Highly Voted 5 years, 8 months ago
Read here: https://radacad.com/dateadd-vs-parallelperiod-vs-sameperiodlastyear-dax-time-intelligence-question In short, parallelperiod can never be right. Parallelperiod returns sales for entire last year. Sameperiodlastyear returns sales for the same period last year.
upvoted 11 times
JohnFan
5 years, 5 months ago
Solution 1: Parallelperiod Solution 2: DATESYTD + DATESYTD Solution 3: TotalYTD
upvoted 1 times
...
...
mohroshdy
Highly Voted 5 years, 4 months ago
B. SAMEPERIODLASTYEAR is the correct answer. YTD can't be calculated using PARALLELPERIOD or PREVIOUSYEAR Simply if I want to calculate the YTD sales and the current date is 15/07/2019 PARALLELPERIOD will give the last year sales up to 31/07/2018 PREVIOUSYEAR will give me the last year up to 31/12/2018
upvoted 8 times
Seyed
5 years, 3 months ago
Yes B. SAMEPERIODLASTYEAR is the correct answer. but PARALLELPERIOD and PREVIOUSYEAR both of them give us the last year from 1/1/2018 up to 12/31/2018. So you can filter them by year not with the date.
upvoted 3 times
...
...
Lhouss
Most Recent 4 years, 5 months ago
C is the correct answer. When we read the question "You need to create a measure to calculate the year-to-date sales and...." first we need to use DATESYTD.
upvoted 1 times
...
CDL
4 years, 6 months ago
C. from Ref: [Prev Yr YTD Sales] = CALCULATE([Total Sales], DATEADD(DATESYTD(Calendar[Date]),-1,Year)) From TotalYTD example: The following sample formula creates a measure that calculates the 'year running total' or 'year running sum' for Internet sales. = TOTALYTD(SUM(InternetSales_USD[SalesAmount_USD]),DateTime[DateKey])
upvoted 2 times
...
r8d1
4 years, 10 months ago
the problem with PARALLELPERIOD is "PARALLELPERIOD always returns full periods at the given granularity level instead of the partial periods that DATEADD returns." Hence if we are comparing "to date" numbers, PARALLELPERIOD may provide an incorrect comparision. We need to use DATESYTD first, then SAMEPERIODLASTYEAR or DATEADD.
upvoted 6 times
borut
4 years, 9 months ago
Finally someone who understand the guestion and the solution at the same time (bravo r8d1). The correct solution for this scenario would be (for example): 1. YTDSalesAmount = CALCULATE(sum(FactInternetSales[SalesAmount]), DATESYTD(DimDate[FullDateAlternateKey])) 2. YTDSalesAmoutnLY_DATEADD = CALCULATE([YTDSalesAmount], DATEADD(DimDate[FullDateAlternateKey], -1, year)) or YTDSalesAmoutnLY_SAMEPERIODLASTYEAR = CALCULATE([YTDSalesAmount], SAMEPERIODLASTYEAR(DimDate[FullDateAlternateKey])) We cannot complete this with PARALLELPERIOD and PREVIOUSYEAR. Both function return all year YTD sale. We need YTD sale to the previous year for the same time period. Function SAMEPERIODLAST YEAR doesn't exist, but only SAMEPERIODLASTYEAR. There must be a trick. So, correct answer is C, DATESYTD. Remember, we don't have measure to calculate YTD sale yet. So, we must create it first, then use it with function DATEADD or SAMEPERIODLASTYEAR.
upvoted 4 times
...
...
Echicken69
4 years, 10 months ago
The following sample formula creates a measure that calculates the previous year sales for Internet sales. =CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]), PARALLELPERIOD(DateTime[DateKey],-1,year))
upvoted 1 times
...
PowerLjubica
4 years, 11 months ago
I think they wanted to ask which particular function you can use to create both measures for current and previous year, and PARALELPERIOD is the one. This only has sense to me.
upvoted 1 times
...
CYRUSD
4 years, 11 months ago
B. SAMEPERIODLAST YEAR + C. DATESYTD is correct (based on article)
upvoted 2 times
...
CYRUSD
4 years, 11 months ago
https://sqldusty.com/2015/09/01/10-dax-calculations-for-your-tabular-or-power-pivot-model-part-1/
upvoted 1 times
...
Ricky7876
5 years, 2 months ago
Im going with DATESYTD... It seems this question wants you to calculated YTD sales first before comparing those to previous year for the same time period. PARALLELPERIOD, SAMEPERIODLASTYEAR, and PREVIOUSYEAR can all get you the same result. DATESYTD is the only one that will get you YTD sales...
upvoted 1 times
...
RutRut
5 years, 2 months ago
If I had to write a measure with ONE function, it would be PARALLELPERIOD (with parameter -1 for last year, and 0 for this year). So the answer is A. DATESYTD (or TOTALYTD) alone doesn't calculate the previous year, and SAMEPERIODLASTYEAR itself doesn't calculate the current year. Besides, I'd normally write a measure using both TOTALYTD and SAMEPERIODLASTYEAR. That gives 2 functions. There is no such answer.
upvoted 1 times
...
JohnFan
5 years, 5 months ago
creates a measure that calculates the 'Running Total' for Internet sales. =CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]), DATESYTD(DateTime[DateKey])) creates a measure that calculates the previous year sales of Reseller sales =CALCULATE(SUM(ResellerSales_USD[SalesAmount_USD]), SAMEPERIODLASTYEAR(DateTime[DateKey]))
upvoted 2 times
coupet
5 years, 4 months ago
measure to calculate the year-to-date sales: DATESYTD measure to calculate the previous year for the same time period: SAMEPERIODLASTYEAR
upvoted 2 times
...
...
emile
5 years, 6 months ago
Same question as #84. In #84 the answer is SAMEPERIODLASTYEAR.
upvoted 2 times
JohnFan
5 years, 5 months ago
In #84, you already "create a measure to calculate the year-to-date sales", so what leftover is "to compare the year-to-date sales with the previous year for the same time period", you thus use SAMEPERIODLASTYEAR. In this question, you need to "create a measure to calculate the year-to-date sales", as well as "to compare the year-to-date sales with the previous year for the same time period". So you can CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]), PARALLELPERIOD(DateTime[DateKey],-1,year/Month)) and CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]), PARALLELPERIOD(DateTime[DateKey], 0, year/Month))
upvoted 5 times
JohnFan
5 years, 5 months ago
ParallelPeriod only works on month, quarter, and year https://radacad.com/dateadd-vs-parallelperiod-vs-sameperiodlastyear-dax-time-intelligence-question
upvoted 2 times
...
...
...
alexhuang
5 years, 10 months ago
Why not DATESYTD or SAMEPERIODLASTYEAR ?
upvoted 2 times
exam_taker5
5 years, 10 months ago
Those functions are used to create lists of dates, but they don't actually do any sort of comparison, like the function in A will do
upvoted 4 times
rhsdeal
5 years, 8 months ago
I am not buying this, based on the way Microsoft teaches this, it is definitely "SAMEPERIODLASTYEAR"!
upvoted 7 times
JohnFan
5 years, 5 months ago
creates a measure that calculates the previous year sales for Internet sales = =CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]), PARALLELPERIOD(DateTime[DateKey],-1,year))
upvoted 1 times
Martin_Nbg
4 years, 8 months ago
Yes, but in the documentation of PREVIOUSYEAR you find the same example using PREVIOUSYEAR.
upvoted 1 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