Forum Discussion
Mohd_Naim
5 years agoHelper II
Issue with Date function
Hi, Can someone help me to understand why below DAX througing Error, when it is working fine for other dates.
Last_30_Days =
VAR MaxDate = "2020-09-29"
Return Date(YEAR(MaxDate),MONTH(MaxDate),DAY(MaxDate)-29)
11 Replies
Replies have been turned off for this discussion
- amitchandakSuper User
Mohd_Naim , Try like
Last_30_Days =
VAR MaxDate = date(2020,09,29)
Return Date(YEAR(MaxDate),MONTH(MaxDate),DAY(MaxDate)-29)Use date function to create date
- Mohd_NaimHelper II
Hi,
This is the actual DAX which is failing for 29 date, Can you please check by running DAX by changing dates,
Last_30_Days =
VAR MaxDate = MAX(Dimdate[Date])
Return Date(YEAR(MaxDate),MONTH(MaxDate),DAY(MaxDate)-29)Thanks,
- Mohd_NaimHelper II
Getting same error even with your solution.
- ryan_mayuSuper User
i am guessing the day 29-29=0, then can't create a date with the day is 0.
if changed to 2020-09-30, then it works.
what's the expected output that you want?