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 29 discussion

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

HOTSPOT -
You are enhancing a Power BI model that has DAX calculations.
You need to create a measure that returns the year-to-date total sales from the same date of the previous calendar year.
Which DAX functions should you use? 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 -
Example:
Total sales on the last selected date =
CALCULATE (
SUM ( Sales[Sales Amount] ),
'Sales'[OrderDateKey] = MAX ( 'Sales'[OrderDateKey] )
)

Box 2: SUM -

Box 3: SAMEPERIODLASTYEAR -
SAMEPERIODLASTYEAR returns a set of dates in the current selection from the previous year.
Example:
-- SAMEPERIODLASTYEAR returns the selected period shifted back one year.

EVALUATE -
VAR StartDate = DATE ( 2008, 07, 25 )
VAR EndDate = DATE ( 2008, 07, 31 )

RETURN -
CALCULATETABLE (
SAMEPERIODLASTYEAR ( 'Date'[Date] ),
'Date'[Date] >= StartDate &&
'Date'[Date] <= EndDate
)
ORDER BY [Date]
Reference:
https://docs.microsoft.com/en-us/dax/calculate-function-dax
https://dax.guide/sameperiodlastyear/

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Muffinshow
Highly Voted 2 years, 1 month ago
Calculate Sum DatesBetween
upvoted 189 times
...
alena2k
Highly Voted 2 years, 1 month ago
Calculate Sum DatesBetween Suggested SamePeriodLastYear expects only 1 parameter: column containing dates
upvoted 63 times
RichardOgoma
2 years, 1 month ago
Good explanation
upvoted 6 times
...
...
rcaliandro
Most Recent 2 months, 1 week ago
You can use SAMEPERIODLASTYEAR but in this case 3 arguments are required so we need to use DatesBetween because there are three arguments. So I would say: CALCULATE, SUM, DATESBETWEEN
upvoted 1 times
...
acvribeiro
11 months, 3 weeks ago
Calculate Sum DatesBetween -- I always look for the number of arguments necessary: DATESBETWEEN(<Dates>, <StartDate>, <EndDate>) SAMEPERIODLASTYEAR(<dates>)
upvoted 10 times
...
Elfmo11
1 year, 1 month ago
CALCULATE, SUM and DATESBETWEEN. DATESBETWEEN because the variables that are declared already contain the dates of last year.
upvoted 5 times
...
Igetmyrole
1 year, 1 month ago
Calculate Sum Datesbetween
upvoted 3 times
...
Mabuse1
1 year, 3 months ago
Who decides on website's final answer? We need to understand his/her level of confidence. Maybe he got the answers from Microsoft.
upvoted 12 times
...
arnoh
1 year, 4 months ago
The location of the formula text in between the images is a bit poorly chosen. It makes it seem like the order is: Option box 1 > ( Sales [sales] ), Option box 2. Even though that wouldn't obviously be possible
upvoted 1 times
...
tke44
1 year, 4 months ago
hmm thanks for the explanation. Calculate, sum, datesBetween
upvoted 1 times
...
ahhida
1 year, 5 months ago
Calculate Sum DatesBetween
upvoted 1 times
...
RazaTheLegend
1 year, 6 months ago
Correct Answer : Calculate, Sum, and DateBetween The DATESBETWEEN function is used to filter a table or a column of dates to a specified date range. It takes two arguments: the first argument is the date column to filter, and the second and third arguments are the start and end dates of the desired date range, respectively. The function returns a table of dates that fall within the specified range. On the other hand, the SAMEPERIODLASTYEAR function is used to retrieve the same period (week, month, quarter, or year) as the one currently selected, but from the previous year. It takes one argument, which is the date column to use as a reference, and returns a table of dates from the previous year that match the current period. This function is often used to compare data across time periods, such as comparing sales in the current year to sales in the same period of the previous year.
upvoted 14 times
...
SanaCanada
1 year, 6 months ago
Correct Answer : Calculate, Sum, and DateBetween The DATESBETWEEN function is used to filter a table or a column of dates to a specified date range. It takes two arguments: the first argument is the date column to filter, and the second and third arguments are the start and end dates of the desired date range, respectively. The function returns a table of dates that fall within the specified range. On the other hand, the SAMEPERIODLASTYEAR function is used to retrieve the same period (week, month, quarter, or year) as the one currently selected, but from the previous year. It takes one argument, which is the date column to use as a reference, and returns a table of dates from the previous year that match the current period. This function is often used to compare data across time periods, such as comparing sales in the current year to sales in the same period of the previous year. No confusion, and no need to further discussion
upvoted 5 times
...
SanaCanada
1 year, 7 months ago
Answer is correct Calculate Sum Sameperiodlstyear no confusion
upvoted 1 times
Burabari
1 year, 6 months ago
The start and end dates has already been calculated in the parameters so DATESBETWEEN is the answer. Using SAMEPERIODLASTYEAR would go an extra year back.
upvoted 4 times
...
...
Pinha
1 year, 7 months ago
Calculate Sum DatesBetween * Sales Last Year = CALCULATE(SUM(Sales[Amount]), SAMEPERIODLASTYEAR(Date[Date])) * Total Sales Q1 = CALCULATE(SUM(Sales[Amount]), DATESBETWEEN(Sales[Date], DATE(2022,1,1), DATE(2022,3,31))) * DatesBetween expects 3 parameters as per the exhibit, SamePeriodLastYear expects one parameter
upvoted 7 times
...
Mati_123
1 year, 7 months ago
Calculate Sum DatesBetween
upvoted 1 times
...
Minio754
1 year, 8 months ago
Calculate Sum DatesBetween
upvoted 1 times
...
Jew0598
1 year, 8 months ago
We're asked to create a measure that returns the year-to-date total sales from the same date of the previous calendar year so why are we not making use of SAMEPERIODLASTYEAR()?
upvoted 1 times
Sowbar
1 year, 8 months ago
That’s because the already created variables generates start date and end date of last year hence no need to compute the dates again using SAMEPERIODLASTYEAR(). Also last expression has 3 parameters so DATESBETWEEN would work.
upvoted 2 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 ...