Forum Discussion
Setting a specific date filter whenever a Report is Run
I need to be able to run an report at anytime and run it with dates from the 18th of the previous month to the 19th the current month. So if I run it on the 28th of September it would auto filter the report with dates between 8/18 and 9/19. Would really be nice if I could run it on Oct 4th and since it is not yet Oct 20th it still uses those dates until 10/19 has passed but the first option would work for now. Any ideas?
Had to make a few changes but this got me in the right direction. It works! Thank you!
2 Replies
- amitchandak
Super User
Razorbx13 , You can have a column like
and use this This period as filter on report
new column =
var _day = day(today())
var _min = if(_day <20 , date(year(today()), month(today())-1,19) ,date(year(today()), month(today()),19))
var _max = if(_day <20 , date(year(today()), month(today())-2,18) ,date(year(today()), month(today())-1,18))return
Switch( True ()
[date] >=_min && [Date] <_max , "This period",
"Others"
)or a measure like
new measure =
var _day = day(today())
var _min = if(_day <20 , date(year(today()), month(today())-1,19) ,date(year(today()), month(today()),19))
var _max = if(_day <20 , date(year(today()), month(today())-2,18) ,date(year(today()), month(today())-1,18))return
calculate([measure], filter(Table, Table[Date] <=_max and Table[Date] >=_min))- Razorbx13
Post Patron
Had to make a few changes but this got me in the right direction. It works! Thank you!