Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

Date calc - not returning correct year

Featured Replies

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!

This seems to work:

Date((Month(Get(CurrentDate))+1); 1;((Year(Get(CurrentDate))-1)))

Why not simply:

Date ( Month ( CurrentDate ) - 11 ; 1 ; Year ( CurrentDate ) )

  • Author

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.

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.

  • Author

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 by Guest

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.