exam questions

Exam PL-300 All Questions

View all questions & answers for the PL-300 exam

Exam PL-300 topic 2 question 97 discussion

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

You have a Power BI model that contains two tables named Sales and Date. The Sales table relates to the Date table by using a many-to-one relationship. The Sales table contains the following columns:

• Date
• Product
• SalesAmount

You need to create a DAX measure for a rolling 31-day sales total that will return the total sales amount for a selected date and the previous 30 days.

Which DAX expression should you use?

  • A. CALCULATE(SUM(Sales[SalesAmount]), DATEADD(Date[Date], -30, DAY))
  • B. CALCULATE(SUM(Sales[SalesAmount]), DATESBETWEEN(Date[Date], Max('Date'[Date])-30, Max('Date'[Date])))
  • C. CALCULATE(SUM(Sales[SalesAmount]), DATESMTD(Date[Date]))
  • D. CALCULATE(SUM(Sales[SalesAmount]), DISTINCTCOUNT(Date[Date]) = 31)
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
MonikaStop
Highly Voted 8 months, 1 week ago
Selected Answer: B
DATESBETWEEN creates a continuous range of dates from the selected date back 30 days. So option B is more suitable for calculating a rolling 31-day total because it correctly defines the date range needed for the calculation.
upvoted 11 times
...
Jayaruwan
Highly Voted 8 months, 2 weeks ago
Selected Answer: A
Answer A is correct because Dateadd provides required set of dates
upvoted 7 times
tko86
5 months, 1 week ago
A. CALCULATE(SUM(Sales[SalesAmount]), DATEADD(Date[Date], -30, DAY)): This is incorrect because DATEADD shifts the entire date context by 30 days. It doesn't create a range of dates. It would calculate the sales for the single day 30 days prior to the currently filtered date, not for the 31-day period.
upvoted 1 times
Odidepse
4 months, 1 week ago
DATEADD just shifts the date, but it’s not ideal for creating a rolling date range like DATESBETWEEN which can specify the exact date range for the rolling 31-day total (starting from the selected date and including the previous 30 days).
upvoted 1 times
...
...
1CY1
8 months, 1 week ago
A is simple and I can't see whats wrong with it. -> Ans : A
upvoted 1 times
1CY1
7 months, 2 weeks ago
Changed mind... I thought A would just give you a single day 30 days earlier. -> Ans : B
upvoted 2 times
...
...
...
SylUK
Most Recent 3 months, 3 weeks ago
Selected Answer: B
B is the correct answer because the question says: 'Create a DAX measure for a rolling 31 days sales total that will return the total sales amount for a SELECTED DATE ( that can be yesterday, today,27/01/2025 or tomorrow. Etc for example) and the PREVIOUS 30 DAYS' In my point of view, this question is asking us to aggregate the sales amount from the PREVIOUS 30 DAYS to the SELECTED DATE. Therefore DATEBETWEEN is the perfect function to use in this case. It can't be DATEADD function because it is a comparison function and the question is not looking for a comparison between the 2 periods ( SELECTED DATE and the PREVIOUS 30 DAYS) . The question is looking for the total sales amount for a specified period (SELECTED DATE and the PREVIOUS 30 DAYS) instead.
upvoted 1 times
...
Pey1nkh
4 months, 2 weeks ago
Selected Answer: B
The DATESBETWEEN function defines a range of dates: From MAX(Date[Date]) - 30 (30 days before the selected date) To MAX(Date[Date]) (the selected date). This correctly captures all dates in the 31-day rolling window. why not Dateadd: The DATEADD function shifts the entire date context backward by 30 days. This means the calculation will consider only the values on dates exactly 30 days ago and not the entire rolling range of 31 days.
upvoted 2 times
...
jaume
6 months ago
Selected Answer: B
DATEADD would return the selected date shifted back 30 days not a period. DATESBETWEEN will return the desired period for the calculation
upvoted 2 times
...
3433bf6
7 months, 2 weeks ago
Selected Answer: B
B DATESBETWEEN as DATEADD returns only 1date while we need a series of dates.
upvoted 2 times
...
MonikaStop
8 months ago
Selected Answer: A
I changed my mind, Max(Date[Date]-30) will not work, so I would go with DATEADD
upvoted 1 times
1CY1
8 months ago
I thought A would just give you a single day 30 days earlier. -> Ans : B
upvoted 1 times
...
...
shedi13
8 months, 1 week ago
I would say A, but after testing im certain thats B
upvoted 3 times
...
b92fc92
8 months, 2 weeks ago
Selected Answer: B
B in my opinion
upvoted 1 times
...
Monsta
8 months, 2 weeks ago
Selected Answer: B
B is the right answer.
upvoted 2 times
...
b9e3c84
8 months, 2 weeks ago
Selected Answer: A
The expresion B Max(Date[]-30) is wrong
upvoted 2 times
...
nelrosell
8 months, 2 weeks ago
A is the correct answer
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 ...