cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports 13: How to I hard code a formula to show 6, 8, and 12 months data?

0 Kudos

Hello,


I have a tracelog report that has a start date and end date paremter. I want to use that report, but without the parameters and write a formula that shows the past 6 months data.. Then I want make a copy of the 6 moth report and make it an 8 month report then another copy to make it a past 12 month report.

I'm working with a Time_STAMP field since that is my only date driven field in the tables I have for my report. I figure I can add a SQL statement to this Data Formula to show past 6, 8 or 12 months data but I'm not sure how to do that. Thanks! 🙂

Date ({TR_BATCH.TIME_STAMP})

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor

Hi Todd,

You'd need a Record Selection Formula like so:

1. Last 6 months:

Date ({TR_BATCH.TIME_STAMP}) IN [Date(DateAdd('m',-6,Minimum(monthtodate))) to Minimum(monthtodate)-1]

2. Last 8 months

Date ({TR_BATCH.TIME_STAMP}) IN [Date(DateAdd('m',-8,Minimum(monthtodate))) to Minimum(monthtodate)-1]

2. Last 12 months

Date ({TR_BATCH.TIME_STAMP}) IN [Date(DateAdd('m',-12,Minimum(monthtodate))) to Minimum(monthtodate)-1]

P.S: I have a feeling this may not get pushed down to the database as a where clause. In which case, it is better to use a SQL Expression for Start and End Dates.

-Abhilash

Answers (0)