Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello colleagues,
I am working creating a calculated column to get different due dates based on each item priority and status.
I used to have nested IFs and worked perfectly fine, but I would like to be more efficient and use SWITCH instead, although I cannot get it to fully work - most of the rows I get are blanks.
Here are both exppressions:
Solved! Go to Solution.
@Agustina , Try like
DueDate_New =
if(NOT(ISBLANK('2021 Cases'[Submission Date])) ,
SWITCH(
TRUE(),
RELATED(AUX_DetailedStatus[Level]) > 4 && RELATED(AUX_Priority[Level]) = 3, DATEADD('2021 Cases'[Submission Date], 21, DAY),
RELATED(AUX_DetailedStatus[Level]) > 4 && RELATED(AUX_Priority[Level]) in {1,2}, DATEADD('2021 Cases'[Submission Date], 5,DAY),
BLANK()
), blank())
Just a quickie: The fact that you get 2 different results from IF and SWITCH only mean that your SWITCH is NOT logically equivalent to your IF. You just make a logical mistake when you translate into SWITCH.
@Agustina , Try like
DueDate_New =
if(NOT(ISBLANK('2021 Cases'[Submission Date])) ,
SWITCH(
TRUE(),
RELATED(AUX_DetailedStatus[Level]) > 4 && RELATED(AUX_Priority[Level]) = 3, DATEADD('2021 Cases'[Submission Date], 21, DAY),
RELATED(AUX_DetailedStatus[Level]) > 4 && RELATED(AUX_Priority[Level]) in {1,2}, DATEADD('2021 Cases'[Submission Date], 5,DAY),
BLANK()
), blank())
User | Count |
---|---|
42 | |
26 | |
21 | |
16 | |
15 |
User | Count |
---|---|
54 | |
35 | |
18 | |
17 | |
15 |