@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
Proud to be a Super User!
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)
Getting same error even with your solution.
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?
maybe you can try this
VAR MaxDate = "2020-09-29"
@ryan_mayu, Already tried and implemented in same way Thanks!! , My only point to bring this up is what's wrong with Date function to calculate Date on mentioned DAX.
@Mohd_Naim , Hey, I obsereved it is not working beacause your day which is 29 and the number you are substracting are same.
For your refernce I increased a day here and it is working. Check the below screenshot which you are using is not working as they are same.
By this we can understand that we have substract either higher number are lesser number than our day.
If you think this is helpful Accept the Solution and leave a like.
As what I mentioned, you can't transfer value 0 to day parameter in the date function. please check the official doc.
Check out the on demand sessions that are available now!
Check out the Winners!
Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.