filemaker - Custom Function - Calculate date of first date of next quarter -


i trying create custom function of given date in filemaker, determine if week of fiscal year number within first week of quarter else calculate first date next quarter. our fiscal year starts on july 1

so defined requirements our fy starts on july 1 , qtrs on week # 1, 14, 27, 40 our weeks go 1-52 , week starts on tuesday (defined day 3). if fy starts on monday first week mon-tues (therefore shortweek) week 2 full 7 day week.

example---> if have date 09/09/2011 week 11 in q1, therefore since not first week of quarter following date next qtr wk 14 first date of 9/27/2011. evaluation needs determine whether given date within first week of qtr (weeks 1, 14, 27, 40) or provide first week of next qtr.

also here initial cf working brian dunnings site.

https://www.briandunning.com/cf/147

i know developed in filemaker there maybe developed in language may apply...

thanks in advance

try starting point:

let ( [  startfy = date ( 7 ; 1 ; year ( datefield ) - ( month ( datefield ) < 7 ) ) ; firsttuesday = startfy - mod ( startfy - 2 ; 7 ) ;  fiscalweek = div ( datefield - firsttuesday ; 7 ) ;  //numbering starts @ 0 targetweek = 13 * ceiling ( fiscalweek / 13 )  ] ; firsttuesday  + 7 * targetweek  ) 

note result always tuesday; may want adjust boundary cases of fiscal year start , end. way works now, you'll result of july 30, 2015 both june 15, 2015 , july 6, 2015.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -