I'm trying to create a query where the results are filtered differently depending on a date that is either input directly or from an existing field. I've got the basics working but the challenge has been that I want the results to sometimes include more than one string.
If the date is before July 1st I want to filter using "FY" and the last two digits of the date's year. "FY18" would be the filter for Feb 2, 2018 for example.
If the date is BETWEEN June 30 and July 15 I want to filter for the last two of the date's year OR the date's year +1. "FY18 OR FY19" would be the filter for July 2, 2018.
If the date is after July 14 I want the filter to be the last two of the date +1. "FY19" would be the filter for August 7, 2018.
I've got the date stuff working and the using the last two of the year but my trouble comes when I try and get the results to include BOTH using an OR. Here's a super simplified example of my iif.
in this example I've removed the date handling because I know I've got that stuff working and I am really only having a problem with the OR being included. I can't seem to work out the string, I suspect it's a matter of single and double quotes which always seem to vex me.Code:Like IIf([testthing]=1,"fy18",IIf([testthing]=2,"'fy18 OR fy19'","fy19"))
Any help would be awesome.
Extra credit for anyone that can give me an easy way to filter for those date ranges that works in a leap year, I've been using the datepart("y") option but in a leap year those days all shift by one.