Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
johndoub
Contributor III
Contributor III

second to last date prior to a specific date

i am trying to find the second to last date prior to a specific date.

the expression max(bus_dt.autoCalendar.date, 2) works fine.

i would like to find the second to last date that is prior to 5/18/2021.

to do that i added a set expression: max({<bus_dt.autoCalendar.date = {"5/18/21"}>} bus_dt.autCcalendar.date, 2)

however, this returns no values.

any advice appreciated.

1 Reply
edwin
Master II
Master II

one way is to save the target date in a variable, assuming you have a field DATE that user selects:
vPrior2Days = date(bus_dt.autoCalendar.date -2)
thinking second to last date is 2 days prior to the selected date.

then in your set analysis you can use the modifer:
{<bus_dt.autoCalendar.date ={'$(vPrior2Days )'}>}