Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Report Formula

Status
Not open for further replies.

DudleyBoy

MIS
Dec 9, 2009
7
GB
Hi,

Could someone help me with modifying this formula.

if {message_stats.msg_transmission_date} >= DATEADD ("m", -12, CURRENTDATE-day(currentdate))+1 and
{message_stats.msg_transmission_date} < maximum(lastfullmonth) + 1 then {message_stats.msg_premium}

This returns a value if the date is within the last 12months to the the end of last full month.

I just need a variant of this that would do it for the year before, e.g. if i ran it today, October 2010, then it would return value with the date range of October 1st 2008 to end September 2009.

Thanks it advance to all for your help.
 
Try writing a formula that uses DateDiff, and find the difference in months. I think you're wanting records between 13 and 24 months, but try it and check. Be sure what the results are before using them to select.

DateDiff will also show the difference in years, that might be what you want.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
if {message_stats.msg_transmission_date} >=
DATEADD ("m", -24, CURRENTDATE-day(currentdate))+1 and
{message_stats.msg_transmission_date} <
DATEADD ("m", -12, CURRENTDATE-day(currentdate)+1)-1
then {message_stats.msg_premium}

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top