Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Solved! Go to Solution.
hi @Charcoal55 ,
try like:
FILTER(
ALL(Dates),
Dates[Date] <= EDATE(MAX(Dates[Date]), -12)
)
EDATE is not time intelligence function and thus less picky.
hi @Charcoal55 ,
try like:
FILTER(
ALL(Dates),
Dates[Date] <= EDATE(MAX(Dates[Date]), -12)
)
EDATE is not time intelligence function and thus less picky.
Hi @Charcoal55
You're right in thinking that DATEADD can be used to adjust the filter context, but there’s a small issue with how you're applying it in the FILTER function.
In your case, you want to return all dates from 2000 to 2022 when the filter context is for 2023. You can achieve this by shifting the latest date in the context (which is defined by MAX(Dates[Date])) back by one year. Here's the correct approach using DATEADD:
FILTER( ALL(Dates), Dates[Date] <= DATEADD(MAX(Dates[Date]), -1, YEAR) )
This approach is cleaner and avoids hardcoding the date offset (e.g., -365). The DATEADD function handles the exact date subtraction, which accounts for leap years and other complexities.
Please mark this as solution if it helps. Appreciate Kudos.
The problem is that I get the following error message when I am trying the formula you suggest:
"The first argument to 'DATEADD' must specify a column."
I interpret it that since MAX returns a scalar value and that is not acceptable by DATEADD because it requires a column as it's first argument.
@Charcoal55 , Formula is correc
DAX
FILTER(
ALL(Dates),
Dates[Date] <= DATEADD(MAX(Dates[Date]), -1, YEAR)
)
Just ensure that
The Dates table is properly related to other tables in your data model.
The filter context is correctly applied.
There are no syntax errors or other issues in the broader DAX expression where this formula is used.
Proud to be a Super User! |
|
User | Count |
---|---|
12 | |
12 | |
8 | |
8 | |
6 |
User | Count |
---|---|
27 | |
19 | |
14 | |
11 | |
7 |