Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Using IF Statement on Date-Times Columns to calculate based on Three conditions

I want to use an IF statement to create three conditions based on appointments for bookings.   I have three columns of times. Created Datetime, Failture datetime and Succeed Date Time. The calculat...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous ,

     

    I think the problem is in the first part of your if statement. Where you say; IF(SLA[Faildate] < today() || SLA[Faildate] < SLA[Succeed], "Fail". You use an 'or' statement here, so if the the faildate < today (which is the case for you last 4 lines) or faildate<succeed then the SLA status is Fail. 

    The Columns SLA2 is your IF statement. SLA3 is showing the expected result (if I am not mistaken)

     

    SLA3 looks like : 

    SLA3 = 
    switch(
    true(),
    ISBLANK(SLA[Succeed]) && SLA[FailDate] <TODAY(),"Fail",
    ISBLANK(SLA[Succeed]) && SLA[FailDate] >= TODAY(), "Inside SLA",
    SLA[Succeed]<=SLA[FailDate], "Pass",
    "")

     I think it is easier to read and I hope it helps.

    jan

    if this is a solution for you, don't forget to mark it as such. thanks

    Jan