If statement not reading periods prior to forecast start

Hi All, 

I was wondering if someone could help with below. 

 

if statement not reading dates prior to forecast start period. 

 

Forecast start period is Mar -19

 

Below should return 0 rather than Mar -19, why is the if statement not reading the first part of the statement?

 

What do I need to change to get it to work?

 

IF PERIOD(Asset Acquisition date) + Asset life < Cal Start of timeline THEN 0 ELSE Asset life

 

Asset Acquisition date (20-08-2014)  - Date formatted with a date prior to forecast start period March-19

Asset life- Number formatted - 28.63

Cal Start of timeline - Time period - Month formatted - Set to March -19.

 

The statement is returning 28.63 instead of 0.

 

Thank you for helping out.

 

Naveed

Best Answer

  • DavidSmith
    Answer ✓

    @NB 

    Because your time settings only run from 2019, the PERIOD element of the formula cannot return August 2014

    2019-05-23_13-04-08.png

     

    Solution:

    Set up a time range that runs from as far back as you need to the current timescale start.

    2019-05-23_13-04-55.png

     

    This will then create a "superset" of months which will allow the PERIOD to return Aug-14 and the formula should then resolve correctly

    2019-05-23_13-05-20.png

    I hope this works for you

    David

     

Answers

  • Hi @NB 

     

    What is your model time settings ? 

     

     

  • Please see attached.

     

    Thanks

  • Your model cal doesn't go before 2019 which is your your formula PERIOD(Asset Acquisition date) returns nothing . 

     

    So your formula is doing this 

     

    If <nothing>+28.63 = (nothing as its time formatted) < Mar 19 then 0 else 28.63 

    If Nothing < mar19 then 0 else 28.63 

     

    which is why you are getting 28.63

     

    you can change your formula to check if 

    if isblank(PERIOD(Asset Acquisition date) + Asset life) or PERIOD(Asset Acquisition date) + Asset life <Cal Start of timeline THEN 0 ELSE Asset life

     

    may be you can put this part as final date to check = (PERIOD(Asset Acquisition date) + Asset life)

     

    if isblank( final date ) or final date < Cal Start of timeline THEN 0 ELSE Asset life

     

    Hope this helps

  • @karank 

    We crossed over on the replies

    Check out my post just before

    David

     

  • Thank you, David.

    The solution worked !!
  • @DavidSmith  yes noticed after i typed my answer (i am a slow typer)  .

     

    But its interesting to see how you are suggesting a superset approach vs my formula approach . Are there any pros and cons if we compare these ? . 

  • @karank 

    No worries, but in terms of pros and cons

     

    Any additional checks through IF statements and additional line items are going to take longer to process than without, so it is always better to remove formula expressions if possible

    Simple is better than Complex!

    Also, the time range is not going to add to model size (unless it is used in a module)

    David

     

  • Excellent!