Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9159

Re: Subtracting 1 year from a single Parameter that prompts for a date range

$
0
0

hi Wade,

 

try something like this in your Report > Selection Formula > Record editor...substituting the fields and parameters for your own...

 

{Orders.Order Date} in {?DateRange}

or

{Orders.Order Date} in dateadd('yyyy', -1, minimum({?DateRange})) to dateadd('yyyy', -1, maximum({?DateRange}))

 

 

the above doesn't really handle leap years in the calc, but you'd need to specify exactly what kind of logic you'd want to use when a leap year comes into play.

 

you could also use something like this

 

{Orders.Order Date} in {?DateRange}
or
{Orders.Order Date} >= date(year(minimum({?DateRange})-1), month(minimum({?DateRange})), day(minimum({?DateRange}))) and
{Orders.Order Date} <= date(year(maximum({?DateRange})-1), month(maximum({?DateRange})), day(maximum({?DateRange})))

 

 

check the Database menu > Show SQL Query to see how these two are processed, especially with leap years...i.e. enter 02/29/2016 as the start date to your parameter. you'll need to figure out how you want to handle these exceptions.


Viewing all articles
Browse latest Browse all 9159

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>