Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam PL-300 All Questions

View all questions & answers for the PL-300 exam

Exam PL-300 topic 2 question 10 discussion

Actual exam question from Microsoft's PL-300
Question #: 10
Topic #: 2
[All PL-300 Questions]

HOTSPOT -
You have a Power BI model that contains a table named Sales and a related date table. Sales contains a measure named Total Sales.
You need to create a measure that calculates the total sales from the equivalent month of the previous year.
How should you complete the calculation? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: CALCULATE -

Box 2: PARALLELPERIOD -
PARALLELPERIOD returns a table that contains a column of dates that represents a period parallel to the dates in the specified dates column, in the current context, with the dates shifted a number of intervals either forward in time or back in time.
Syntax: PARALLELPERIOD(<dates>,<number_of_intervals>,<interval>) dates: A column that contains dates. interval: The interval by which to shift the dates. The value for interval can be one of the following: year, quarter, month.
Incorrect:
SAMEPERIODLASTYEAR returns a table that contains a column of dates shifted one year back in time from the dates in the specified dates column, in the current context.
Syntax: SAMEPERIODLASTYEAR(<dates>)
DATESMTD returns a table that contains a column of the dates for the month to date, in the current context.
Syntax: DATESMTD(<dates>)
Box 3: 'DATE' [Month]
Reference:
https://docs.microsoft.com/en-us/dax/parallelperiod-function-dax https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Leonardorcaquino
Highly Voted 2 years, 1 month ago
CALCULATE SAMEPERIODLASTYEAR 'DATE'[DATE]
upvoted 219 times
KoS83
1 year, 8 months ago
Correct! PARALLELPERIOD needs 3 arguments and it returns the sales for the entire year
upvoted 13 times
...
maymia87
7 months, 2 weeks ago
There's a Sum missing. CALCULATE(SUM(), SAMEPERIODLASTYEAR(Date[Date]))
upvoted 1 times
maymia87
7 months, 2 weeks ago
Nevermind, Sum isn't necessary as Total Sales is a measure not a column and already calculates the Sum.
upvoted 12 times
...
...
cokimon
11 months ago
This would return the sales on that single date of last year. You need date[month] to get the sales for the entire month of last year.
upvoted 3 times
Dani_eL
8 months ago
no. date([month]) will throw an error as the function expects a DATE format and month is integer(or string if format mmm). It MUST be date[Date]
upvoted 5 times
...
...
...
Muffinshow
Highly Voted 2 years, 1 month ago
Calculate SamePeriodLastYear 'Date'[Month] ParallelPeriod could work but here the second agrument only takes one parameter and ParallelPeriod requires three
upvoted 52 times
Mati81111
2 years, 1 month ago
SAMEPERIODLASTYEAR accepts a data column, Month will usually be either text (Jan) or Integer (1). so: CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date]))
upvoted 68 times
jsking
1 year, 10 months ago
Yup! This is correct!!
upvoted 1 times
...
...
babinaprad
2 years, 1 month ago
Which one is the correct answer is it 'Date[Month] or 'Date'[Date] as it has got equal number of votes so confused.
upvoted 4 times
NaudeDucon
3 months ago
'Date'[Date] is the correct type of data. Then you could make use of Table visualization with a column as 'Date'[Month] to see all the Sales of each previous month
upvoted 2 times
...
cokimon
11 months ago
You need date[month] to get the sales for the entire month of last year.
upvoted 1 times
...
catpoisoncat
1 year, 9 months ago
I guess 'Date'[Date]. If you look up for the SAMEPERIODLASTYEAR DAX, it has a Date parameter.
upvoted 3 times
...
...
...
rcaliandro
Most Recent 2 months, 1 week ago
The correct answer is CALCULATE, SAMEPERIODLASTYEAR, 'Date'[Month]
upvoted 1 times
rcaliandro
2 months ago
Sorry I was wrong! If you use Date[Month] It will raise an error because The specified month column in the SAMEPERIODLASTYEAR function is not of type DATE. It should be the following configuration: - CALCULATE - SAMEPERIODLASTYEAR - 'Date'[Date]
upvoted 1 times
...
...
Sophieeeeee
3 months, 4 weeks ago
Have tried to build the measures. It woks with the following: 1. SAMEPERIODLASTYEAR(<dates>) Sales Previous Year = CALCULATE([Total Sales],SAMEPERIODLASTYEAR(Date[Date])) 2. PARALLELPERIOD(<dates>,<number_of_intervals>,<interval>) Sales Previous Year = CALCULATE([Total ales],PARALLELPERIOD(Date[Date],-12,MONTH)) 3. DATEADD(<dates>,<number_of_intervals>,<interval>) Sales Previous Year = CALCULATE([Total Sales],DATEADD(Date[Date],-12,MONTH))
upvoted 3 times
...
SureshReddyMoole
5 months ago
CALCULATE is used to change the context in which the data is evaluated. [Total Sales] is your existing measure that calculates total sales. SAMEPERIODLASTYEAR('Date'[Date]) shifts the context of the date by one year, allowing the calculation to be made for the same period last year. This measure will give you the total sales for the same month in the previous year. Make sure that your date table ('Date') is marked as a date table and properly related to your Sales table.
upvoted 2 times
...
bernardoklosowski
8 months ago
It needs to be 'DATE'[DATE] because SAMEPERIODLASTYEAR only accepts Date columns as arguments. If you try to input the Month column the following error is prompted: "MdxScript(Model) (216, 5) Calculation error in measure •_ProjectMeasures'[Measure Last Year]: A column specified in the call to function 'SAMEPERIODLASTYEAR' is not of type DATE. This is not supported."
upvoted 2 times
...
Dani_eL
8 months, 1 week ago
AS per Microsoft Definition found in: https://learn.microsoft.com/en-us/dax/sameperiodlastyear-function-dax Example The following sample formula creates a measure that calculates the previous year sales of Reseller sales. DAX: LastYearSales= CALCULATE(SUM(ResellerSales_USD[SalesAmount_USD]), SAMEPERIODLASTYEAR(DateTime[DateKey]))
upvoted 2 times
...
GowthamMupparapu
8 months, 1 week ago
The data recording frequency is not specified, but based on the snap, we should assume that the data is recorded on a monthly basis. In accordance with this assumption, the syntax using PARALLELPERIOD AND SAMEPERIODLASTYEAR would be: 1. CALCULATE(SUM('Table Name'[Total Sales]), PARALLELPERIOD('Table Name'[Date], -12, Month) 2.CALCULATE(SUM('Table Name'[Total Sales]), SAMEPERIODLASTYEAR('Table Name'[Date])) Given only one argument in the final box, this is the correct answer - CALCULATE, SAMPERIODLASTYEAR, DATE[DATE]
upvoted 1 times
...
Roh1410
9 months ago
CALCULATE SAMEPERIODLASTYEAR 'DATE'[DATE] / 'DATE'[MONTH]
upvoted 1 times
...
MayurV19
10 months, 1 week ago
Answer is wrong and misleading. Correct answers: CALCULATE SAMEPERIODLASTYEAR 'DATE'[DATE] We should use SAMEPERIODLASTYEAR because it as a function would calculate the expression for the previous year period to the period in filter context. Also, we should input the 'DATE'[DATE] column for references the previous year period.
upvoted 1 times
...
Kostali
10 months, 3 weeks ago
The correct : 1) CALCULATE 2) SAMEPERIODLASTYEAR 3) 'DATE'[DATE] The fonction accepte 3 param like this PARALLELPERIOD(<dates>,<number_of_intervals>,<interval>)
upvoted 2 times
...
agelee
11 months, 2 weeks ago
The Suggested Answers are so ridiculous. I answer correctly and later get irritated that again wrong answers under 'Show Suggested Answer'. Mine: CALCULATE SAMEPERIODLASTYEAR 'DATE'[DATE]
upvoted 2 times
...
cem_bxl
12 months ago
Just one question, why there are so many "correct answers" which are actually not correct on this website? Most of the time I need to check the discussions to find the right answer.
upvoted 10 times
...
SwapnJ
1 year ago
It is correct, I think it should be Calculate , Sameperiodlastyear,Date[Month] as they have asked in the question to find the total sales from the equivalent month of the previous Year.
upvoted 2 times
...
Igetmyrole
1 year, 1 month ago
Calculate, Sameperiodlastyear and `Date`[Date] are the answers.
upvoted 2 times
...
RicoPallazzo7
1 year, 2 months ago
Calculate sameperiolastyear 'DATE'[DATE] Does it need a grouping function like SUM around the [TotalSales]? Otherwhise how can it group them? Or it is only to filter and obtain for a row with a particular data the same the last year?
upvoted 2 times
...
safz
1 year, 3 months ago
PARALLELPERIOD. SamePeriodLastYear function in DAX does not support calculating data for multiple months
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 ...