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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Start Report on odd day

Status
Not open for further replies.

BB45

Technical User
Feb 3, 2005
42
US
Hi all,

CR 10
CE 10
SQL 2000

I am creating a formula to set the date range of a report that is to be run on the 25th of the month. What I want it to do is include data from the 25th - end of the previous month as well.

Here is what I have created to find the end of the previous month and then subtract from the currentdate to get my range but it is not working. It only seems to be looking at the first conditional.

{@Formula} =
{Table.DateCreated} >=
if (datepart ("d",(maximum( LastFullMonth)))= 30)
then (dateadd ("d", -31, Currentdate))
else
if (datepart ("d",(maximum( LastFullMonth)))= 31)
then (dateadd ("d", -32, Currentdate))
else
if (datepart ("d",(maximum( LastFullMonth)))= 28)
then (dateadd ("d", -29, Currentdate))
else
if (datepart ("d",(maximum( LastFullMonth)))= 29)
then (dateadd ("d", -28, Currentdate))

Let me know if there is a better way.

Thanks
BB
 
To find the 25th of the previous month use the Report->Selection Formulas->Record and place:

(
{table.datecreated} >= dateserial(year(currentmonth),month(currentdate)-1,25)
and
{table.datecreated} <= cdate(year(currentdate),month(currentdate),25)
)

You make conflicting statements so I was unsure "What I want it to do is include data from the 25th - end of the previous month as well." The 25th is NOT the end of the previous month, I assumed that you wanted the 25th from the 25th of the previous month to the 25th of the current month.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top