exam questions

Exam 70-778 All Questions

View all questions & answers for the 70-778 exam

Exam 70-778 topic 2 question 8 discussion

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

You have a Power BI model that contains the following tables:
✑ Sales (Sales_ID, DateID, sales_amount)
✑ Date (DateID, Date, Month, week, Year)
The tables have a relationship. Date is marked as a date table in the Power BI model.
You need to create a measure to calculate the sales for the last 12 months.
Which DAX formula should you use?

  • A. CALCULATEx(SUM(sales[sales_amount]) DATESYTD (‘Date’ [Date]))
  • B. CALCULATE(SUM(sales[sales_amount]), SAMEPERIODLASTYEAR (‘Date’ [Date]))
  • C. SUM(sales[sales_amount])-CALCULATE(SUM(sales[sales_amount]), SAMEPERIODLASTYEAR(‘Date’[Date]))
  • D. SUM(sales[sales_amount])-CALCULATE(SUM(sales[sales_amount]),DATESYTD(‘Date’[Date]))
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
References:
https://msdn.microsoft.com/en-us/library/ee634825.aspx
https://docs.microsoft.com/en-us/power-bi/desktop-quickstart-learn-dax-basics https://msdn.microsoft.com/en-us/library/ee634972.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
Ashu
Highly Voted 5 years, 5 months ago
Answer is correct
upvoted 15 times
rhsdeal
5 years, 3 months ago
Why the (-) minus. That doesn’t make any sense to me. B looks the most correct. I will try all these and see what happens.
upvoted 1 times
Hien
5 years, 3 months ago
the answer C is correct, Sum all untill now minus sum all until 1 year ago.
upvoted 16 times
mssql
4 years, 2 months ago
How do you know there are only 2 years of data?
upvoted 4 times
...
...
...
...
Eslam_Medhat
Highly Voted 4 years, 8 months ago
Answer is "C". Here you need to calculate your sales in the last 12 month. "How much did you sale in the last 12 month".which evaluates to my (current sales) - (sales from 12 month ago). For ex: if you had 10$ after 12 month you have 100$ so how much did you gain in the last 12 month ? (100 "current" - 10 "started with from 12 month") so you gained 90$ in this period. Hope it helps.
upvoted 12 times
ktn375
4 years, 4 months ago
I don't think it works if we have more than 24 month of data.
upvoted 5 times
...
...
Lhouss
Most Recent 4 years ago
Strange question, or is somehting missing in the text ? Given a Date D1 (15/12/2012), C is calculating the difference between SalesAmount for D1 and SalesAmount of the D1 of last year (15/12/2011). B also is only giving SalesAmount of the D1 of last year (15/12/2011). None of the options are giving SalesAmount for last 12 months of a given date (Rolling 12 months). In my sens, to calculate total sales of last 12 months (rolling 12 months), we should use something like following DAX formula : CALCULATE ( SUM ( 'Sales'[SalesAmount] ), DATESINPERIOD('Date'[Date], LASTDATE('Date'[Date]), -12, MONTH))
upvoted 3 times
FrdFrd
3 years, 10 months ago
Totally agree with you. None of the options is the correct answer for what they are asking for. Also agree with your DAX formula to calculate the sales for the last 12 months for any given filter context.
upvoted 1 times
...
...
CDL
4 years, 1 month ago
I go with C. Think it thru via a example. Let’s say it’s Apr, last 12 month means current year to date Jan to Apr PLUS last years (12-4=8 months) from May to Dec, which means last whole year sum amount minus same period last year’s “sum amount”. BTW, YTD function usually is used to compute “Running total”
upvoted 1 times
...
Shuwy
4 years, 3 months ago
Definitely B
upvoted 1 times
...
borut
4 years, 4 months ago
As i understand this...If the current context is april 2019, it must calculate the sale from 1. may 2018 to 30. april 2019. If the current context is Q3 2019, a measure must calculate the sale from 1. october 2018 to 30. september 2019, and so on. So, i created my own measure and tested it. The test was successful. Last12MonthSaleAmount = var enddate = LASTDATE('Date'[Date]) var startdate = DATEADD(enddate, -1, year) return CALCULATE(sum(Sales[SalesAmount]), DATESBETWEEN('Date'[Date], startdate + 1, enddate)) In this example, i use the DATEADD and DATESBETWEEN function. You can use other functions instead: DATEADD >> SAMEPERIODLASTYEAR DATESBETWEEN >> DATESINPERIOD It will return the same result. If anyone claims that there is a correct answer, please give us a complete solution that returns the correct result. Not just say which answer is correct. I don't believe any of you, until the statement is proved by fact. My conclusion: --------------- I think the answers are not compatible with the task.
upvoted 5 times
...
borut
4 years, 4 months ago
There is no correct answers.
upvoted 1 times
...
Echicken69
4 years, 5 months ago
Sales (Selected Month) = SUM ( Sales[Sales] ) Sales Last Year = CALCULATE ( SUM ( Sales[Sales] ), SAMEPERIODLASTYEAR ( ‘Date'[Date] ) ) Sales YTD = TOTALYTD ( SUM ( Sales[Sales] ), ‘Date'[Date] )
upvoted 3 times
...
SaidDjaiz
4 years, 9 months ago
The correct Answer is B
upvoted 2 times
...
RutRut
4 years, 9 months ago
Measure B gives a sum of previous year's sales, which is incorrect in this scenario. Measure C gives a sum of sales for last 12 months, which is correct calculation for every date. I've tested it. I didn't believe, but answer C is really correct and B is definately not.
upvoted 9 times
...
kilowd
4 years, 9 months ago
Answer is B Example The following sample formula creates a measure that calculates the previous year sales of Reseller sales. DAX Copy =CALCULATE(SUM(ResellerSales_USD[SalesAmount_USD]), SAMEPERIODLASTYEAR(DateTime[DateKey]))
upvoted 2 times
...
Olivia
4 years, 10 months ago
The answer is B. Look at the example in the link: https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax
upvoted 8 times
...
coupet
4 years, 11 months ago
Need to create a measure to calculate the sales for the last 12 months (Answer explained) https://community.powerbi.com/t5/Desktop/Need-to-create-a-measure-to-calculate-the-sales-for-the-last-12/m-p/721893#M348422
upvoted 3 times
...
AnetaK
5 years ago
Can we use time intelligence measures when the relation is on date_id and not an a date column?
upvoted 1 times
AnetaK
5 years ago
https://books.google.pl/books?id=Tv9eDwAAQBAJ&pg=SA2-PA37-IA24&dq=power+bi+time+intelligence++%22another+requirement+for+the+calendar+table+is+to+be+part%22+%22with+a+column+of+type+date%22&hl=en&sa=X&ved=0ahUKEwiJquW8lPblAhUDt4sKHY9vB70Q6AEIKTAA#v=onepage&q=power%20bi%20time%20intelligence%20%20%22another%20requirement%20for%20the%20calendar%20table%20is%20to%20be%20part%22%20%22with%20a%20column%20of%20type%20date%22&f=false
upvoted 1 times
AnetaK
5 years ago
Could anyone, please, answer that question?
upvoted 1 times
...
...
...
exam_taker5
5 years, 5 months ago
I agree, the answer is correct.
upvoted 4 times
...
Vav
5 years, 8 months ago
It should be B
upvoted 9 times
...
Lauritzi
5 years, 9 months ago
Is this answer ok????
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