Forum Discussion
unclejemima
Post Patron
5 years agoIS Last 2 Years True/False DAX
Can someone help me turn this formula I have for last 2 days into last 2 years True/False answer? IsTwoDaysAgo = if('Calendar'[DateTime12am]=TODAY()-2,"True","False") Let me know!
- 5 years ago
unclejemima , IsTwoDaysAgo is correct. if you need two years date , try like
IsTwoDaysAgo = if('Calendar'[DateTime12am]>=date(year(TODAY())-2,1,1) && [DateTime12am] <=today(),"True","False")
IsTwoDaysAgo = if('Calendar'[DateTime12am]>=date(year(TODAY())-2,month(TODAY()),day(TODAY())) && [DateTime12am] <=today(),"True","False")
unclejemima
Post Patron
5 years agoThank you!!
Do both give the same result or why the different options?
I used this...
IsTwoYearsAgo = if('Calendar'[DateTime12am]>=date(year(TODAY())-2,month(TODAY()),day(TODAY())) && [DateTime12am] <=today(),"True","False")
Ashish_Mathur
Super User
5 years agoHi,
Try this calculated column formula
='Calendar'[DateTime12am]>=edate(today(),-24)
Hope this helps.