Handling weeks in Planning with leap years

How are people handling weeks-based forecasting in Planning?
I have a Planning app that has 53 time periods with an extra week in August to handle the leap year (thus the 53). There are dynamically calculated months, quarters, and the always-loved YearTotal in Time as well.
This works fine in a leap year, but is kludgy otherwise as it includes an additional month in August – this skews form spreads.
And it gets even uglier when calculating/data viewing year over year forms as the start week for September should vary across leap and non-leap years.
It occurred to me that I could create a custom dimension called “Weeks” with all 53 weeks and then use a nested dimension strategy that combined a 12 months Time dimension and the relevant weeks (some hard coding there on forms). I could then use the form column/row suppression to show/hide weeks by month.
The upsides:
1)     Smaller block size, as Weeks would go sparse and Time would get reduced from 53 to 12 members.
2)     True week/month relationships in reporting/forms through prepopulated data and suppression.
3)     True 4-4-5 spreads to months (although an algorithm to spread to the separate Weeks would have to exist, but that is irrespecitive of the 4-4-5 spread). NB -- 445, etc., concepts don't work in a Planning app with weeks.
I see a few downsides to this:
1)     The possibility of entering data by week into the wrong month <-- Form construction could mitigate this.
2)     Block creation issues in calcs as there is another sparse dimension to take care of.
3)     Many more blocks <-- How about 53 of them?
Any thoughts on this approach? I’m not scared of the calcs although I appreciate it’s a little more complicated. I don’t think it breaks the Scenario dimension’s opening/closing of periods. I guess I’m trying to see if there are any hidden issues with this approach and if anyone has figured out a better way to do this.
Thanks,
Cameron Lackpour

The Calendar Component does take account of the leap year.
If you look at the code, it has
if ((month == FEBRUARY) && (isLeapYear(year))) numCells++;Not sure what went wrong. I'll take a look at it.
- Winston

Similar Messages

  • How to do a date validation with leap years

    I'm doing a date validation program in my Java class, and well it's pretty hard (for me that is). I have to be able to type in a date, have it say whether it's a leap year or not, and print out the number of days in the month. It seems pretty straight forward, but I get confused on trying to do the 'if else' statements and even the simplest things like getting the day prompting to work. >< The years I'm doing only goes through 1000 to 1999, so that's why those numbers are there. The program isn't complete, so if anyone could help show me what I'm doing wrong in the areas I'm working on then I'd appreciate it...and I'm still kind of in the basics of Java so if you do hint me with some code then I'd appreciate it if it was stuff that's not too advanced so yea.
    // Dates.java
    // Determine whether a 2nd-millenium date entered by the user
    // is valid
    import java.util.Scanner;
    public class Dates
    public static void main(String[] args)
    int month, day, year; //date read in from user
    int daysInMonth; //number of days in month read in
    boolean monthValid, yearValid, dayValid; //true if input from user is valid
    boolean leapYear; //true if user's year is a leap year
    Scanner scan = new Scanner(System.in);
    //Get integer month, day, and year from user
    System.out.print("Type in the month: " );
              month = scan.nextInt();
    System.out.print("Type in the day: " );
              day = scan.nextInt();
    System.out.print("Type in the year: " );
              year = scan.nextInt();
    //Check to see if month is valid
    if (month >= 1)
    month = month;
    else
    if (month <= 12)
    month = month;
    else;
    //Check to see if year is valid
    if (year >= 1000)
    year = year;
    else
    if (year <= 1999)
    year = year;
    else;
    //Determine whether it's a leap year
    //Determine number of days in month
    if (year == 1 || 3 || 5 || 7 || 8 || 10 || 12)
         System.out.println (Number of days in month is 31);
         else (year == 4 || 6 || 9 || 11)
         System.out.println (Number of days in month is 30);
    //User number of days in month to check to see if day is valid
    //Determine whether date is valid and print appropriate message
    // Dates.java
    // Determine whether a 2nd-millenium date entered by the user
    // is valid
    import java.util.Scanner;
    public class Dates
    public static void main(String[] args)
    int month, day, year; //date read in from user
    int daysInMonth; //number of days in month read in
    boolean monthValid, yearValid, dayValid; //true if input from user is valid
    boolean leapYear; //true if user's year is a leap year
    Scanner scan = new Scanner(System.in);
    //Get integer month, day, and year from user
    System.out.print("Type in the month: " );
              month = scan.nextInt();
    System.out.print("Type in the day: " );
              day = scan.nextInt();
    System.out.print("Type in the year: " );
              year = scan.nextInt();
    //Check to see if month is valid
    if (month >= 1)
    month = month;
    else
    if (month <= 12)
    month = month;
    else;
    //Check to see if year is valid
    if (year >= 1000)
    year = year;
    else
    if (year <= 1999)
    year = year;
    else;
    //Determine whether it's a leap year
    //Determine number of days in month
    if (year == 1 || 3 || 5 || 7 || 8 || 10 || 12)
         System.out.println (Number of days in month is 31);
         else (year == 4 || 6 || 9 || 11)
         System.out.println (Number of days in month is 30);
    //User number of days in month to check to see if day is valid
    //Determine whether date is valid and print appropriate message
    }

    Here are some helpfull hints for you:
    1. Your code is really hard to read, there are two main reasons for this. First, your indentation sucks. Second, you seem to be fascinated with saving two (ok four if you count the shift key) keypresses to avoid using { and }.
    2. Not using the brackets (you know { and } which you like to avoid) also is causing your code to do some stuff you don't realize or want to happen, or at least it would be if your code compiled.
    3. If statements require arguements, "year == 1" is an arguement, "3" is not an arguement. Each operator like the or operator ("||") is essentially a new if and requires a complete arguement. So the following code peice:
    if (year == 1 || 3 || 5 || 7 || 8 || 10 || 12)Literally translates to if year equals 1 or if 3 or if 5 or if 7 or if 8 or if 10 or if 12. Doesn't make much sense in english, and it doesn't make much sense in Java either.
    4. I am pretty sure "year" is not the variable you want in the code snippet above (the one used in hint 3), especially considering years 1, 3, 5, 7, 8, 10, and 12 are not between 1000 and 1999. You need to be really carefull not make these kind of mistakes when coding, because they are by far the hardest to track down and fix later since they don't really throw up any flags or anything at compile or run time. Take your time and think thuroughly about each line of code while coding it, it will save you tons of time in the long run.
    5. What exactly do you expect statements like "month = month;" to do? That translates as make month equal to month. Do you go to the bank and say " I have exactly $3.56 in my pocket, so I would like to deposite all $3.56 and then withdraw $3.56 and put it back in my pocket"? How do you think the teller would look at you? Teller would probably do it, but the teller would feel like he/she wasted time with you and that you are not really right in the head. Java feels the same way when you make it do the same thing, and you love to do it.
    6. Code like the following is all wrong, and for more reasons than pointed out in hint 5.
    if (month >= 1)
    month = month;
    else
    if (month <= 12)
    month = month;
    else;Let's say someone put 13 in as the month. It passes the first check because 13 is greater than or equal to 1. so month which is 13, now gets set to 13 (gee that was effective). Now we hit the else and things get confusing because you didn't use brackets or proper indentation (hint 1) so we don't know what your real intent was. Did you mean else do nothing, and the next if statement is then executed, or did you mean to just run the next if statement if the else condition was met? Fortunatly it doesn't matter here because the next if statement is failed anyways since 13 is not less than or equal to 12.
    So, we leave this code with month ebing 13, wait when did we add a 13th month to the calendar? Are you using the Jewish calendar? Could be, except even if I put 1234567 as the month your code would except it as valid, and I know no calendar with that many months. Try writing this in english first and translating it to jave, like i would probably say "if the month is greater than or equal to 1 and less than or equal to 12 then the month is valid." Course now what do you do if it is invalid? Hmm, maybe I would actually say "while the month is less than 1 or greater than 12 ask the user for the month" until they get it right.
    There are a few other problems, but most of them are probably things you haven't learned yet, and they are not show stoppers so we will let them fly. You already have a lot of work to do to make this better. But I do have one more really really big usefull hint for you:
    Never, ever, under any circumstances, should you ever ask in any way or even hint at asking for someone else to provide code solutions to your problems. So "so if you do hint me with some code then I'd appreciate it if it was stuff that's not too advanced " was a very bad thing to do, but fortunatly for you you followed it with proof you were trying to write the code yourself. Had the code you provided not been so full of problems it was obvious a beginner wrote it, you would probably have gotten much less cordial responses. I would seriously consider avoiding any implication of wanting code, at least until you become a regular poster here and people know you are not just looking to get your homework done for you.
    Hope some of this helps.
    JSG

  • Problem with leap years in Calendar demo

    I've just looked at the Calendar demo component:
    http://developers.sun.com/prodtech/javatools/jscreator/reference/codesamples/samplecomps/calendar.html
    There is a little bug : it doesn't seem to manage leap years.
    Go to february 2008, and you won't the the 29th of February 2008 in the calendar.
    Please try to correct this bug quickly. It is a bad idea to let people get source code with bugs as a a demo.
    Thanks
    Thibaut REGNIER
    See TastePhone, my Open Source app made whith Java Studio Creator:
    http://www.club-java.com/TastePhone/J2ME/MIDP_mobile.jsp

    The Calendar Component does take account of the leap year.
    If you look at the code, it has
    if ((month == FEBRUARY) && (isLeapYear(year))) numCells++;Not sure what went wrong. I'll take a look at it.
    - Winston

  • Does anyone know how much an early termination fee would be on a basic plan with a year left on the contract?

    I have a year left on my basic phone contract but we have been discussing breaking up our family plan and going elsewhere.

    Oh no! Your posting hurt my feelings Amyliz67! Why do you want to leave our happy wireless family? There are options on breaking up the family plan and avoiding any termination fees. For example, you have the option to transfer your mobile number in your name. This way you can continue to enjoy great service from us and the original account does not have to incur a termination fee. If interested then please reply so we can assist.  ArnettH_VZW Follow us on Twitter @VZWSupport  If my response answered your question please click the "Correct Answer" button under my response. This ensures others can benefit from our conversation. Thanks in advance for your help with this!!

  • HELP! Files won't open and previously had Firefox icon instead of DW icons!  Leap Year thing?

    Hi!  I went to update my website, which I do every night before the first day of every month and all the files had a FIrefox icon instead of the usual Dreamweaver one.  I have shut down, reinstalled DW MX 2004 but the files still do not open.  The icons have now changed to DW but they are not opening with right click, opening from Applications folder, double clicking the file, from get info and open with DW.  I am stumped. HELP!  Need to update for March 1st.
    Is it something to do with Leap Year 29th Feb?  Checked the clock in preferences but can't see how this affects it.
    Firefox is always updated but the latest version does not seem to be as efficient as previous upgrades.  We installed Chrome as well.  Do they interfere with each other?

    Hi Ken
    I wish the 7.1 updater download had helped but it didn¹t.  All the files
    were backed up before the installation, which went fine.
    Mac 10.5.8
    We used Disc Warrior to defrag the hard drive, which did not make a
    difference.
    We recently started using Chrome, so now have 3 browsers in the dock,
    Safari, Firefox and Chrome.  Do they interfere in any way with each other?
    The files, which I hadn¹t touched for a month as I update on a monthly
    basis, initially had the Firefox icon.
    Below is the message to send to Apple, which did not go through their report
    system!  A little disillusioned with the service!
    Model: iMac9,1, BootROM IM91.008D.B08, 2 processors, Intel Core 2 Duo, 3.06
    GHz, 4 GB
    Graphics: kHW_NVidiaGeForceGT130Item, NVIDIA GeForce GT 130,
    spdisplays_pcie_device, 512 MB
    Memory Module: global_name
    AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x8E),
    Broadcom BCM43xx 1.0 (5.10.91.22)
    Bluetooth: Version 2.1.9f10, 2 service, 0 devices, 1 incoming serial ports
    Network Service: Ethernet, Ethernet, en0
    Network Service: AirPort, AirPort, en1
    Serial ATA Device: WDC WD1001FALS-40K1B0, 931.51 GB
    Serial ATA Device: PIONEER DVD-RW  DVRTS08
    USB Device: Built-in iSight, (null) mA
    USB Device: Keyboard Hub, (null) mA
    USB Device: iLok, (null) mA
    USB Device: Apple Optical USB Mouse, (null) mA
    USB Device: Apple Keyboard, (null) mA
    USB Device: Deskjet 3840, (null) mA
    USB Device: BRCM2046 Hub, (null) mA
    USB Device: Bluetooth USB Host Controller, (null) mA
    USB Device: IR Receiver, (null) mA
    FireWire Device: d2 quadra (button), LaCie, 800mbit_speed
    Does not mean a thing to me.
    I am not late with updating the site, which is about New Zealand culture,
    month by month (www.englishteacher.co.nz). Probably only the third time I
    have been late since 2005. Not a huge amount of traffic, ~300 a month and
    free access to content but I would like to solve this problem.
    Could a reciprocal link have caused a problem?
    At my wits end.
    I really appreciate the help though.
    Cheers Yvonne
    From: Ken Binney <[email protected]>
    Reply-To: <[email protected]>
    Date: Wed, 29 Feb 2012 06:42:11 -0700
    To: Yvonne and Bill Hynson <[email protected]>
    Subject: HELP! Files won't open and previously had Firefox
    icon instead of DW icons!  Leap Year thing?
    Re: HELP! Files won't open and previously had Firefox icon instead of DW
    icons!  Leap Year thing?
    created by Ken Binney <http://forums.adobe.com/people/Ken+Binney>  in
    Dreamweaver - View the full discussion
    <http://forums.adobe.com/message/4236682#4236682>
    Not necessarily related, but did you also install the 7.1
    updater? http://www.adobe.com/support/dreamweaver/downloads_updaters.html
     Windows or MAC?
    Replies to this message go to everyone subscribed to this thread, not
    directly to the person who posted the message. To post a reply, either reply
    to this email or visit the message page:
    http://forums.adobe.com/message/4236682#4236682 To unsubscribe from this
    thread, please visit the message page at
    http://forums.adobe.com/message/4236682#4236682. In the Actions box on the
    right, click the Stop Email Notifications link. Start a new discussion in
    Dreamweaver by email
    <mailto:[email protected].ad
    obe.com>  or at Adobe Forums
    <http://forums.adobe.com/choose-container!input.jspa?contentType=1&container
    Type=14&container=2240>  For more information about maintaining your forum
    email notifications please go to
    http://forums.adobe.com/message/2936746#2936746.

  • Function CALCULATE_DATE and  leap year

    Hi,
    I need to substract some months from a date. I tried to use the standard function CALCULATE_DATE but it has a proble with leap years. If I execute it with the following parameters:
    CALL FUNCTION 'CALCULATE_DATE'
         EXPORTING
              days        = '0'
              months      = '-24'
              start_date  = '20080229'
         IMPORTING
              result_date = X.
    The value that I get in X is '00000000' because 2006 isn't a leap year. The problem is that the function doesn't know how to deal with this. The solution is very easy, buy if it's possible I would like to use a standard function.
    Do you know if there are any standard function that has no problems with leap years?
    Thanks and kind regards,
    Marcela.

    Hi Marcela,
    Welcome to SDN.
    You can try this FM <b>RP_CALC_DATE_IN_INTERVAL</b>.
    data: wa_date like sy-datum.
    call function 'RP_CALC_DATE_IN_INTERVAL'
             exporting
                  date      = '20080229'
                  days      = 0
                  months    = 24
                  signum    = '-'
                  years     = 0
             importing
                  calc_date = wa_date.
    Hope this will help.
    Regards,
    Ferry Lianto

  • Bug or error when handling leap years with WDS/DS

    Hi all,
    I discovered a difference in outcome with Build and Debug (without screens) and Build and Debug with Web Determinations or Determinations Server when calculating days within leap years.
    I use the function DayDifferenceInclusive to calculate the amount of days in an insurance period.
    the amount of days of the insurance period = DayDifferenceInclusive(the start date of the insurance, the end date of the insurance)
    With the regression tester or Build and Debug (without screens) I get the following outcome for the following input:
    *93 = DayDifferenceInclusive(02-29-2008, 05-31-2008)*
    When we use Web Determinations or Determinations Server we get the value of *92* for the exact same input data when it should be 93.
    Is this a bug in the java code? How can we fix this or is there a work around for it?
    We're in the middle of System Integration Testing for a huge project so help is much appreciated!
    Best regards,
    Niels Roest

    Niels,
    thanks for that - and it looks like in the Netherlands daylight savings started on the 30th of March 2008, which as far as I know is the trigger for this error.
    I have reproduced the issue against 10.1 using the period 01 October 2010 to 30 October 2010, which contains the date that daylight saving started in Australia.
    As for ways to work around the issue, I can offer 3:
    * wait for 10.2 - it's in beta at the moment (though given your opening comments, this might not be an option for you)
    * set your server locale to one that doesn't have DST
    * work around the issue in rules:
    Firstly, the issue is that the shipping version fails because it doesn't take into account that one of the days is shorter than the standard 24 hours.
    The trick is to replace the DayDifference function with the HourDifference function and round to the nearest number of days.
    So given a rule that looks like:
    the result = DayDifference(date one, date two)
    it can be rewritten as:
    The result = round(HourDifference(date one at 00:00:00, date two at 00:00:00) / 24, 0)
    * the whole "at 00:00:00" is necessary because HourDifference works on datetimes, not dates.
    Sorry for the hassle.
    Regards
    Andrew

  • I bought a iphone 4 32gb verizon from apple store 4-7-11 had problem receaver exchanged 12-11 next one died no battery power works with cord dead without so 4-6-12 made apointment apple store emeryville ca they said leap year too late out of warrenty,

    i bought a iphone 4 32gb verizon from apple store 4-7-11 3:00pm,  had problem with  receaver no sound could not hear person i called  exchanged 12-11 exchanged iphone 4 32gb verizon died no battery power works with cord dead without so 4-6-12 made next available apointment apple store bay st.  emeryville ca for 4-7-12 1:15pm
    they said leap year added extra day so too late out of warrenty, sorry but can sell you new one  i called apple said same , a company that big should take care of customers the origanel receipt should of said under date of purchess warrnty to end date following year,

    That's strange, because no where in the iPhone's limited warranty does it state "365 days", but it does state 1 year. I think the only way they could get out of that is because of the battery, which is not covered by the warranty. HOWEVER, it is stated on AT&T's website that claims are handled from 31-365 days, which would explain why the Apple people acted as such. I know you have Verizon, but since it is (essentially) the same device, it's under the same warranty.
    http://www.att.com/esupport/article.jsp?cv=820&sid=KB64687#fbid=MG9VDbF7hX1
    Many people have had stories about issues happening as soon as their warranty expires, with products in general.
    I'd just consider upgrading, and selling your old one.

  • Have family plan with 250 data which I almost use each month.  Going on vacation and will be on the road for two weeks.  Should I up my data for a month then change back.  Is it worth it or should I just run over and pay the extra 15 per gig?

    have family plan with 250 data which I almost use each month.  Going on vacation and will be on the road for two weeks.  Should I up my data for a month then change back.  Is it worth it or should I just run over and pay the extra 15 per gig?

    Hello mlazaretti. Vacation time is awesome. (Especially a road trip!) Since you will be going out for two weeks, you never know if having extra data may come in handy. I highly recommend switching to the next tier up so this way you have more data. This way it is only $10.00 more versus $15.00, and you dont have to worry about overages. Then change back at the start of the next billing cycle.
    If you need help making this change let us know! Have a safe trip!
    NicandroN_VZW
    Follow us on twitter @VZWSupport

  • I smashed my iPhone and was wondering how much for a new one as it is now unusable. On a 2 year plan with telstra and just out of the 1 year mark. Please help me. Thanks

    Need help with how much a new iphone will be.
    I smashed my first one yesterday and is now unusable. Im currently on a 2 year contract plan with Telstra and just out of the 1 year mark.
    i dont know what to do next.. Please help.
    Thankyou

    Hi tiarnafromnsw,
    If you have a damaged iPhone, you may find the following page helpful:
    Service Answer Center - iPhone
    http://support.apple.com/kb/index?page=servicefaq&geo=Australia&product=iphone
    Regards,
    - Brenden

  • In order to take advantage of the iPhone trade in, do I need to have met my upgrade eldigbility date, or do I just need to re-sign up for a new 2 year plan with the new iPhone 6?

    In order to take advantage of the iPhone trade in, do I need to have met my upgrade eldigbility date, or do I just need to re-sign up for a new 2 year plan with the new iPhone 6?

    thanks, a HUGE suggestion for you:  Please add that to the restrictions of the trade-in details online, it mentions that nowhere and is VERY deceptive.  Since at least 90% of 5c and 5s users are under a 2 year contract and both phones have been out just a year, there will be a majority of bitter customers who fell for the ad and will be taking advantage of the buy out options the other carriers are offering.

  • Savings Plan with Monthly contribution to be used for employees weekly paid

    Hi,
    We have a Savings Plan with Monthly contribution. This plan has to be used for employees for weekly paid employees.
    How to configure this for weekly paid employees and for which payroll will the contribution gets deducted.
    Please help on this issue.
    Regards,
    Ilyas

    Ilyas ,
    In SPRO - Personnel management-Benefits-Plans-Savings plans- Define employee contribution rules
    In the contribution limits for regular payroll - If your savings plans contribution types is by percentage then give the maximum pre-tax has 100.00 , if it is not by percentage -then give the contribution units to its maximum .
    To recheck -go to Pa30 and benefits tab -saving plans and regular contribution tab and check your reference period for contributions.
    Let me know if it doesn't work
    Shalini

  • HT4528 I currently use Verizon and have a Blackberry with an unlimited data plan. Is there a way I can buy an unlocked iphone and keep my unlimited data plan bypassing Verizon's requirement to get a new plan with a 2 year committment?

    Is there a way to purchase a new iPhone and to continue my unlimited data plan without having to sign a new 2 year committment and new plan with Verizon?

    You don't buy an unlocked phone. You buy a Verizon iPhone at full retail. I just did this myself last month. I paid full retail for the phone and activated it on my plan. This allowed me to get a new phone before I was eligible to upgrade and keep my unlimited data. I also got a good deal on trading in my iPhone 5.
    You can buy the phone through Verizon or through Apple. If you buy it through Apple, I'd suggest that you not have them activated but do that yourself by logging into your account on your computer.
    Best of luck.

  • How much do I have to pay when buying an iPhone with 2-year contract? Carrier Plan- AT&T & Next

    How much do I have to pay when buying an iPhone with 2-year contract? Carrier Plan- AT&T & Next
    Thank You

    iosforever wrote:
    How much do I have to pay when buying an iPhone with 2-year contract? Carrier Plan- AT&T & Next
    Thank You
    You would probably find out the answer buy calling those carriers.

  • Calculating a Leap Year with a FOX Formula

    Hi to everybody.
    Is it posible to calculate a leap year using BPS in BW 3.5 with a FOX formula?
    The code i need to write is something like this:
    if ((year % 4 == 0) AND ((year % 100 != 0) OR (year % 400 == 0)) then
      it is a leap year;
    else
      it isn´t a leap year;
    endif;
    The problem i have is that my variable year is an standard type 0CALYEAR and I cannot do i.e.
    Year MOD 4, and save this value to an integer because 0CALYEAR and INTEGER are different types of variables.
    Any idea?
    Thanks in advance!
    Edited by: Ivan Lopez on Jan 15, 2008 5:24 PM
    Edited by: Ivan Lopez on Jan 15, 2008 5:24 PM

    Hi,
    Eventhough variable is on the characteristic 0CALYEAR, you can assign the variable value to an integer in FOX.
    Declare a local variable of type integer.
    DATA YEAR TYPE I.
    YEAR = VARV(variable).
    Now you can do MOD operations on YEAR.
    Regards,
    Bindu

Maybe you are looking for