Topic Options
#35859 - 03/04/13 12:36 PM Leap year question
Steve Schwartz Offline
Adagio God

Registered: 03/10/02
Posts: 4509
Loc: Wynnewood, PA
In addition to a MTD formula, a report uses this formula:

if {SRW90 Transactions.Date} in LastYearMTD then {SRW90 Transactions.Sales amount} else 0.

It will never pick sales from Feb 29, 2012. What can I do to get those on the report?

My client strongly prefers not to enter a runtime value when running his reports, but basing all formulas off the report date.

Thanks

Steve

Top
#35861 - 03/04/13 02:02 PM Re: Leap year question [Re: Steve Schwartz]
Retired_Guy Offline
Adagio Master

Registered: 03/16/99
Posts: 10504
Loc: Canada
This is the reason we recommend to NEVER use February 29th as a "business day" - it makes comparative reporting a bear. Not only will you not pick up the February 29 transactions, but you'll get a date calculation error on February 29 since the date does not exist in the year prior.

To get the last day on ANY month, subtract 1 from the first day of the month following. Generally, you'll want to find out whether you are running a report on the last day of the month. Do that with:
Code:
IF MONTH(TODAY())+1 = MONTH(TODAY()) then 
  IF {SRW90 Transactions.Date} in LastYearMTD then 
    {SRW90 Transactions.Sales amount} 
    ELSE 0
  ELSE
  IF MONTH({SRW90 Transactions.Date})=MONTH(TODAY()) and
     YEAR({SRW90 Transactions.Date})=YEAR(TODAY())-1 then {SRW90 Transactions.Sales amount}
  ELSE 0
_________________________
Andrew Bates

Top
#35865 - 03/04/13 07:13 PM Re: Leap year question [Re: Retired_Guy]
Steve Schwartz Offline
Adagio God

Registered: 03/10/02
Posts: 4509
Loc: Wynnewood, PA
Thanks Andrew

I think this might do the trick. I'll try it out tomorrow.

Steve

Top
#35918 - 03/06/13 04:22 AM Re: Leap year question [Re: Steve Schwartz]
Steve Schwartz Offline
Adagio God

Registered: 03/10/02
Posts: 4509
Loc: Wynnewood, PA
Hi Andrew

It turns out that your formula works if you change the first row to:

IF MONTH(TODAY() + 1) = MONTH(TODAY()) then

(with the 1 inside the parens)

Thanks

Steve

Top


Moderator:  Christa_Meissner 
Who's Online
1 registered (1 invisible), 52 Guests and 0 Spiders online.
Key: Admin, Global Mod, Mod
Forum Stats
1865 Members
5 Forums
14458 Topics
70633 Posts

Max Online: 432 @ 01/20/25 10:17 PM
April
Su M Tu W Th F Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30