Forum Discussion
Anonymous
6 years agoNot applicable
Nested IF Statement Ignoring Blanks
Hi, Im looking for some help creating a new column to distinguish wether an Appointment was Early, Late or In Target. I have 3 fields that are going to be used APPOINTMENT ACTUAL_START_DATE,...
- 6 years ago
Hi Anonymous
If you're adding this as a calculated column, you don't need all of the MAX functions. They are essentially calculating the max value for that entire column - not what you're after!
I always favour the SWITCH function rather than nested IF statements as I find it easier to read.
Try adding a calculated column with the expression below:
APPTCTGY = SWITCH( TRUE(), ISBLANK( FACT_Appt[APPOINTMENT ACTUAL_START_DATE] ), "EARLY", FACT_Appt[APPOINTMENT ACTUAL_START_DATE] < FACT_Appt[APPOINTMENT_WINDOW_START_DATE ], "EARLY", FACT_Appt[APPOINTMENT ACTUAL_START_DATE] > FACT_Appt[APPOINTMENT_WINDOW_END_DATE], "LATE", FACT_Appt[APPOINTMENT ACTUAL_START_DATE] >= FACT_Appt[APPOINTMENT_WINDOW_START_DATE] && FACT_Appt[APPOINTMENT ACTUAL_START_DATE] <= MAX(FACT_Appt[APPOINTMENT_WINDOW_END_DATE] ), "IN TARGET" )Best regards,
Martyn
amitchandak
6 years agoSuper User
You can use Switch True and use isblank to check for blank
Example
Switch (true(),
condition, action,
condition, action,
condition, action,
else action)
Anonymous
6 years agoNot applicable
Thanks. What logiv would you use within the switch to ignore the null values in the ACTUAL_APPOINTMENT)START_DATE field.
Thanks
Alex
- amitchandak6 years agoSuper User
Switch( true(),
isblank(APPOINTMENT_ACTUAL_START_DATE ), "Early",
....
)