Categorize By Calendar Weeks (1999 - Week 1, 1999 - Week 2)

Ever had the need to categorize/sort data so you can use it for fiscal months?
This formula will categorize data based upon the fiscal week that a date field
falls into. Armed with the knowledge of which fiscal weeks fall into a fiscal
month, you can retrieve the summarized data from a view.
Date2 := @TextToTime("1/1/" + @Text(@Year(Date)));
DaysToStartDate := 7-((@Weekday(Date2))-1);
YearStartDate := @Adjust(Date2;0;0;DaysToStartDate;0;0;0);
FiscalWeek:=@If ((((Date-YearStartDate)/86400)/7) < 0 ; 52 ;
@Integer((((Date-YearStartDate)/86400)/7)) + 1);
@If ((((Date-YearStartDate)/86400)/7) < 0 ; @Text(@Year(Date)-1) +
@Text(FiscalWeek) ; @Text(@Year(Date)) + @Text(FiscalWeek))

This was last published in November 2000

Dig Deeper on Domino Resources - Part 3

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...