ndelac Posted January 17, 2007 Posted January 17, 2007 Why would this calc not return "the first day of the month that occurred 11 months ago"... Date(Month(CurrentDate)-11;1;Year(CurrentDate-32)) ...and return "2/1/2005" instead? My first guess was that subtracting 32 days from the current date in the "Year" section of the date would allow for an accurate "last year". Was hoping to be able to "slide" dates on an existing report to account for the change of year... *CurrentDate is a global date field set with Get(CurrentDate) upon opening. Thx!
Salesman0Gil Posted January 17, 2007 Posted January 17, 2007 This seems to work: Date((Month(Get(CurrentDate))+1); 1;((Year(Get(CurrentDate))-1)))
comment Posted January 17, 2007 Posted January 17, 2007 Why not simply: Date ( Month ( CurrentDate ) - 11 ; 1 ; Year ( CurrentDate ) )
ndelac Posted January 17, 2007 Author Posted January 17, 2007 Sorry, all - my description was lacking. I set up a calendar-year sales chart and have now been asked to make it "sliding", or a dynamic 12-month snapshot. So instead of ReportMonth1Start = "January this yr", it'd be ReportMonth1Start = "first day of month 11 mos ago, dynamically calc the yr".... I dove into the whole -32 days thing to accommodate Jan07, and in the hopes of not having to use a big Case statement.
mr_vodka Posted January 17, 2007 Posted January 17, 2007 Piggybacking on Comment's post, in your report generating script, just have something like this. Enter Find Mode [] Insert Calculated Result [ SalesTable:SalesDate; Date ( Month ( gCurrentDate ) - 11 ; 1 ; Year ( gCurrentDate ) ) & ".." & gCurrentDate ] Perform Find [] I renamed your CurrentDate field to gCurrentDate to avoid confusion on the forum.
ndelac Posted January 18, 2007 Author Posted January 18, 2007 (edited) Well eureka - I didn't realize that the month() parameter would interpret the proper year... Thought the month/day/year parameters were all isolated... Thanks to you all for the illumination. Edited January 18, 2007 by Guest
Recommended Posts
This topic is 6866 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now