Forum Discussion
Anonymous
6 years agoNot applicable
DATEADD
I am using a meausre to create a vertical line at a certain point
This DAX creates the line succesfully
referenceline =
IF(
MAX('FACT SALES'[Date]) = DATE(2020,5,1),
20000, // height of the line
BLANK()
)
If I Replace the DATE(2020.5.1) With ANY expression using DateAdd, LastDate, COnvert etc it will fail to produce the line
But When I use it as an expression it fails
Referenceline =
IF(
MAX('FACT SALES'[Date]) = DATE(YEAR(MAX('FACT SALES'[Date])), MONTH(MAX('FACT SALES'[Date]))-1, DAY(MAX('FACT SALES'[Date]))),
20000, // height of the line
BLANK()
)
This also fails
MAX('FACT SALES'[Date]) = DATEADD(LASTDATE('FACT SALES'[Date]), -30,DAY) , //THIS DOESNT WHY??
200, // height of the line
BLANK()
200, // height of the line
BLANK()
why is it only the literal DATE(2020,4,30) that will work
2 Replies
- AnonymousNot applicable
Anonymous
You can use the below measures.
Max Date = MAX(Supplier[Date])MAX Date1 =var _mm = MONTH([Max Date])var _dd = DAY([Max Date])var _year = YEAR([Max Date])returnIF ([Max Date] = DATE(_year,_mm,_dd), 5000, Blank())You are comparing the max date by breaking the year, months and date of max date in parts. But why have you reduced the month by 1.This will obviously not match the MAX Date for Sales.Regards,Harsh NathaniDid I answer your question? Mark my post as a solution! Appreciate with a Kudos!! - az38Community Champion
Anonymous
pay attention for remark in DATEADD() documentation here https://docs.microsoft.com/en-us/dax/dateadd-function-dax
The result table includes only dates that exist in the dates column.