Date Range Expressions

Simple but powerful expressions to quickly filter data. I use them often by storing these values on a 'DateRangeExpression' Property Control and passing the expression directly to the 'Data Limited by Expression' option: ${DateRangeExpression}



-
Today[Date]=Date(DateTimeNow())
Last 30 Days[Date] >= dateadd('dd',-30,DateTimeNow())
This WeekWeek([Date]) = week(DateTimeNow()) and Year([Date]) = year(DateTimeNow())
This MonthMonth([Date]) = month(DateTimeNow()) and Year([Date]) = year(DateTimeNow())
Year to DateYear([Date]) = Year(DateTimeNow())
Last MonthMonth([Date]) = Month(dateadd('mm',-1,DateTimeNow())) and Year([Date]) = Year(dateadd('mm',-1,DateTimeNow()))
Q1Quarter([Date]) = 1 and Year([Date]) = Year(DateTimeNow())
Q2Quarter([Date]) = 2 and Year([Date]) = Year(DateTimeNow())
Q3Quarter([Date]) = 3 and Year([Date]) = Year(DateTimeNow())
Q4Quarter([Date]) = 4 and Year([Date]) = Year(DateTimeNow())
Begining of MonthDate(Year(DateTimeNow()),Month(DateTimeNow()),1)
End of MonthDateAdd('day',-1,date(Year(DateTimeNow()),Month(DateAdd('month',1,DateTimeNow())),1))
End of Last MonthDateAdd("day",-1,date(Year(DateTimeNow()),Month(DateTimeNow()),1))
End of Next MonthDateAdd("day",-1,date(Year(DateTimeNow()),Month(DateAdd("month",2,DateTimeNow())),1))
First Weekending of the yearDateadd("day",6 - DayOfWeek(DATE(Year(DateTimeNow()),1,1)), DATE(year(DateTimeNow()),1,1))
Last Weekending (last saturday)DateAdd("week",Week(DateTimeNow()) - 2,Dateadd("day",6 - DayOfWeek(DATE(Year(DateTimeNow()),1,1)),DATE(year(DateTimeNow()),1,1)))
End of this weekDateAdd("week",Week(DateTimeNow()) - 1,Dateadd("day",6 - DayOfWeek(DATE(Year(DateTimeNow()),1,1)),DATE(year(DateTimeNow()),1,1)))
End of next weekDate(DateAdd("week",Week(DateTimeNow()),Dateadd("day",6 - DayOfWeek(DATE(Year(DateTimeNow()),1,1)),DATE(year(DateTimeNow()),1,1))))
Previous Quarter end dateDateAdd("day",-1,DateAdd("quarter",Quarter(DateTimeNow()) - 1,Date(Year(DateTimeNow()),1,1)))
--

Previous
Next Post »