Forum Discussion

cathoms's avatar
cathoms
Responsive Resident
5 years ago
Solved

Help improving nested IF statements

Hi. In the dataset I am working with there is a numeric column, CancellationLeadTimeInDays, for how many days between an appointment and when it was cancelled. The values range from -26 (negative val...
  • blopez11's avatar
    5 years ago

    I think you can use a switch

     

    Cancellation Notice Time Buckets =
    SWITCH (
    TRUE (),
    [CancellationLeadTimeInDays] >= 92, "More than 3 months",
    [CancellationLeadTimeInDays] >= 61, "2-3 months",
    [CancellationLeadTimeInDays] > 30, "1-2 months",
    [CancellationLeadTimeInDays] > 14, "3-4 weeks",
    [CancellationLeadTimeInDays] > 7, "1-2 weeks",
    [CancellationLeadTimeInDays] > 2, "Within 1 week",
    [CancellationLeadTimeInDays] > 1, "Within 48 hours",
    [CancellationLeadTimeInDays] >= 0, "Within 24 hours",
    "After appointment"
    )