2 Replies Latest reply on Jul 7, 2017 1:42 PM by cmj

    Calculate Remaining Period This Year


      I'm fairly new to FM (using 11 Pro) and am attempting to calculate remaining periods that will occur in the year.

      A couple examples:

      1. A paycheck is received every Friday. How many Fridays are there remaining in the current year?

      2. A bill is paid on the 22nd of every month. How many times will this occur for the balance of this year?


      Yes - these are two different calculations but the answers will be very useful in a number of calculations that I face.



        • 1. Re: Calculate Remaining Period This Year

          First off, 11 pro is past end of life and no longer supported. Please update as soon as possible for the best level of support and compatibility.


          Here's the old documentation for filemaker 11 functions, you want to seek out the "date functions" category.



          Both of your questions can be solved using the "Get(CurrentDate)", "WeekOfYear", "Day" and "Month" functions.


          In FileMaker, there are many ways to do "compounded" calculations (calcs that use multiple functions), so it's better to learn the functions, what they return, how they work; so that you can create your own compounded calcs as needed.


          Also, get a copy of filemaker pro advanced. With that you can use custom functions, like this one:

          FileMaker Custom Function:CountDays(from; to; dayPattern)


          #1 - How many Fridays are in the current year (using above custom function):

          CountDays( Date( 1 ; 1 ; Year(Get(CurrentDate)) ) ; Date( 12 ; 31 ; Year(Get(CurrentDate)) ) ; "6" )


          #2 - Return number of months left in which there is a 22nd day:


             Day(Get(CurrentDate) >= 22 ; 12 - Month(Get(CurrentDate)) ;

             13 - Month(Get(CurrentDate))



          Of course, you could still do #1 in the calculation engine without using a custom function, but take a look at that link, rewriting all of that would be a pain so it's much easier to use it as a custom function. There are hundreds of readily available powerful custom functions that are well worth the cost of FileMaker Pro Advanced to get access to use.

          1 of 1 people found this helpful
          • 2. Re: Calculate Remaining Period This Year

            Thanks Mike. I appreciate your help on this.

            I should have mentioned that I do have FM Pro Advanced. I've been reluctant to upgrade in fear that my level of confusion will only increase with a new version.

            I will review your links and try to digest the information.