Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
Trying to create a DAX command using this function.
My data is as follows:
The Month column is formatted as Date.
If I take out the SAMEPERIODLASTYEAR element it returns the value for the current month OK. But as soon as I add in SAMEPERIODLASTYEAR it returns a blank field.
Can anybody see what I'm doing wrong here?
Solved! Go to Solution.
hi @Fusilier
try like:
Prev Year =
CALCULATE(
SUM(data[Incident]),
FILTER(
ALL(data),
data[month]=EDATE(EARLIER(data[Month]), -12)
),
ALLEXCEPT(data, data[Location])
)or
Prev Year2 =
SUMX(
FILTER(
data,
data[month]=EDATE(EARLIER(data[month]), -12)
&&data[location]=EARLIER(data[location])
),
data[Incident]
)
it worked like:
Apologies, my fault. Solution 2 works like a dream!
THANK YOU!
hi @Fusilier
try like:
Prev Year =
CALCULATE(
SUM(data[Incident]),
FILTER(
ALL(data),
data[month]=EDATE(EARLIER(data[Month]), -12)
),
ALLEXCEPT(data, data[Location])
)or
Prev Year2 =
SUMX(
FILTER(
data,
data[month]=EDATE(EARLIER(data[month]), -12)
&&data[location]=EARLIER(data[location])
),
data[Incident]
)
it worked like:
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 24 | |
| 17 | |
| 9 | |
| 7 | |
| 6 |