IF THEN statement with Time Dimension


`Hi Team,
I have a module dimensioned by Employee Roster and Time. In it I have a line item 'Train/Predict'. In this line item I want to add a formula such that if it's a past time period then Train and for future time period = predict. I tied using the following formula - IF ITEM(TIME) <= Current Month? THEN Train ELSE Predict, but that throws an error that data type mismatch and it should be 'BOOLEAN'

Additional Information about the setup:

  1. I have a Train/Predict List item which is the data type for the line item Train/Predict
  2. Current Month? is in systems settings and the formula is a boolean line item that ticks of only the current month 

Can you please help in how I can reference Time line item in the formula for Train/Predict?

Thanks ! 



Best Answer

  • BrunoRodriguez

    Hello @PranayG ,


    If I have understood it correctly, I would use the "Current Month?" boolean in your system module to drive the if statement with something similar to this:


    • IF SYS.Current Month? THEN Train ELSE Predict


    An additional nuance to consider is that your boolean is only true for the last month, so any period before would render Predict as a result. As such, you may want to use a different boolean to control the formula (i.e., something similar to a switchover where you are identify every time period before a date and define them as true.



    Kind regards,

    Bruno Rodriguez


  • Hi @BrunoRodriguez,

    Thank you so much for helping out with this one. As instructed I created a new line item Actual Month? that ticked off all the periods before the current period and then used this new line item in the formula for train predict.