cancel
Showing results for
Did you mean:
Member

## Calculated Column with multiple IF Else Then

I've searched for an answer to this, but haven't been able to find a solution.

I need a statement that says:

IF [FIELD A] <-15 THEN "EARLY"

IF [FIELD A] >-15<15 THEN "ON-TIME"

ELSE "LATE"

In other words, I am looking at [FIELD A] .  I need a new column that will look at the value in [FIELD A] and give 3 results, depending on the value in [FIELD A] - "EARLY", "ON-TIME" OR "LATE".

2 ACCEPTED SOLUTIONS

Accepted Solutions
Established Member

## Re: Calculated Column with multiple IF Else Then

@schwinnen You can use a switch statement:

SWITCH(TRUE(),

[Field A] < -15,"Early",

[Field A] >= -15 && [Field A] < 15,"On Time",

"Late")

Community Support Team

## Re: Calculated Column with multiple IF Else Then

Hi

Yes, switch can do this, you can also create a calculate column using nested if() statement in DAX like pattern below:

```Result =
IF (
Table[FIELD] < -15,
"EARLY",
IF ( Table[FIELD] > -15 && Table[FIELD] < 15, "ON-TIME", "LATE" )
)
```

Regards,

Jimmy Tao

2 REPLIES 2
Established Member

## Re: Calculated Column with multiple IF Else Then

@schwinnen You can use a switch statement:

SWITCH(TRUE(),

[Field A] < -15,"Early",

[Field A] >= -15 && [Field A] < 15,"On Time",

"Late")

Community Support Team

## Re: Calculated Column with multiple IF Else Then

Hi

Yes, switch can do this, you can also create a calculate column using nested if() statement in DAX like pattern below:

```Result =
IF (
Table[FIELD] < -15,
"EARLY",
IF ( Table[FIELD] > -15 && Table[FIELD] < 15, "ON-TIME", "LATE" )
)
```

Regards,

Jimmy Tao