You have a measure Total Sales and a related Date table. A slicer forces users to select exactly one calendar month. You must create a Prior Month Sales measure that returns sales for the month immediately before the selected month, while honoring any other report filters. Which DAX formula should you use?
The DATEADD function shifts every date in the current filter context by a specified interval and returns that shifted set of dates. Wrapping it in CALCULATE applies the shifted date table as a new filter, allowing Total Sales to be evaluated for the month exactly one month earlier than the selection while still honoring all other filters. SAMEPERIODLASTYEAR moves the context back an entire year, not one month. DATESINPERIOD creates a rolling-period window that counts back a number of days and can include part of the current month, so it does not guarantee the exact previous calendar month. PARALLELPERIOD with -12 months also returns the equivalent month a full year earlier, not simply the immediately prior month.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the DATEADD function do in DAX?
Open an interactive chat with Bash
How is SAMEPERIODLASTYEAR different from DATEADD in DAX?
Open an interactive chat with Bash
Why can't DATESINPERIOD be used for calculating 'Prior Month Sales'?
Open an interactive chat with Bash
Microsoft Power BI Data Analyst
Model the Data
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .