Question on ifelse

Hi Team, I have created a calculated field called “Recovery Status” using ifelse statement.

The criteria is, if the SLA date difference is >= 30, then it exceeds SLA and if its <=30 then it is “Within SLA”. I also need to add one more condition/field in my ifelse statement (Recovery Status) called “Recovered”.

Recovered is basically the count of items when recovery completed date is not Null. I need to show “Within Sla”, “Exceed Sla” and “Recovered” in a vertical bar chart. How do I add “Recovered” in my ifelse statement? In the table below, i need “Recovered” under “Recovery Status”, this should count any items that has recovery completed date as not Null.

Recovery Status = ifelse({SLA Date Difference} >= 0 and {{SLA Date Difference} <= 30, ‘Within SLA’,
{SLA Date Difference} >= 31, “Exceed SLA”, “Others”)

SLA Date Difference = datediff({Discovered_date), now(), ‘DD’)

Table:

**|Recovery Status | Recovery Completed Date | Event Recovery Time Frame | |ISSUE Count

|Within SLA | Null | 0-30 | | 1
|Exceed SLA | May 5, 2024 | 30-60 | |1
|Exceed SLA | May 5, 2024 | 30-60 | |1

Hi @Rus,

Can you try this for your recovery status?

ifelse(
{SLA Date Difference} >= 0 and {{SLA Date Difference} <= 30, ‘Within SLA’,
{SLA Date Difference} >= 31, ‘Exceed SLA’,
isNotNull({Recovery Completed Date}), ‘Recovered’,
‘Other’
)

Hi David, thanks for the reply. I tried this method and it is only returning me Exceed SLA and Within SLA.

From your sample data, it looks like it’s possible for an item to satisfy the first 2 conditions while having a recovery completed date. Try changing the order of the conditions in your ifelse. The condition for ‘Recovered’ should be first.

Thank you so much David, it worked when reversed.