Forum Discussion

Blake753's avatar
Blake753
Icon for Helper II rankHelper II
5 years ago
Solved

EDATE for days or weeks

I am recycling a function that works perfectly minus the EDATE function.  I am looking for the same thing as EDATE but I need it to operate as days or weeks (whichever one is easier) as opposed to months.  Is there a simple solution for this?  Here's my code for reference:

 

Prod Metric 2 = var Ldate = DATE(YEAR(MAX('Date Slicer'[Pay Period])), MONTH(MAX('Date Slicer'[Pay Period])), DAY(max('Date Slicer'[Pay Period])))
var Fdate = EDATE(Ldate,-6)
var sumUCC = [Productivity]
RETURN
IF(min(Dates[Date_Id])<Fdate, blank(), IF(min(Dates[Date_Id])>Ldate,blank(),sumUCC))
 

6 Replies

  • IF you have a date and you add integers (positive and negative) to it, the addition will return the day that many days after or before the date.