Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
power bi function SWITCH does not suppport comparing values of type true/false. Consider using the VALUE or FORMAT
The orginial condition was
power bi function SWITCH does not suppport comparing values of type true/false. Consider using the VALUE or FORMAT
StatusColourNum = SWITCH('ActiveCIP'[Status]=BLANK(),8, "Completed",1, "In progress & on schedule",2,"Yet to commence",3,"Behind schedule",4,"No status",5,"Not Progressing",6, "Archive",7)
How can this statement work?
TIA
Solved! Go to Solution.
Hi @dd88
Try this
StatusColourNum =
SWITCH(
TRUE(),
ISBLANK('ActiveCIP'[Status]),8,
'ActiveCIP'[Status] = "Completed", 1,
'ActiveCIP'[Status] = "In progress & on schedule", 2,
'ActiveCIP'[Status] = "Yet to commence", 3,
'ActiveCIP'[Status] = "Behind schedule", 4,
'ActiveCIP'[Status] = "No status", 5,
'ActiveCIP'[Status] = "Not Progressing", 6,
'ActiveCIP'[Status] = "Archive", 7
)
Alternatively, if all possible conditions (string values) of 'ActiveCIP'[Status] are listed in that code (values 1 through 7) then you can make the default result of the SWITCH be the result you want for BLANK values
StatusColourNum =
SWITCH(
TRUE(),
'ActiveCIP'[Status] = "Completed", 1,
'ActiveCIP'[Status] = "In progress & on schedule", 2,
'ActiveCIP'[Status] = "Yet to commence", 3,
'ActiveCIP'[Status] = "Behind schedule", 4,
'ActiveCIP'[Status] = "No status", 5,
'ActiveCIP'[Status] = "Not Progressing", 6,
'ActiveCIP'[Status] = "Archive",7,
8
)
Regards
Phil
Proud to be a Super User!
Hi @dd88
Try this
StatusColourNum =
SWITCH(
TRUE(),
ISBLANK('ActiveCIP'[Status]),8,
'ActiveCIP'[Status] = "Completed", 1,
'ActiveCIP'[Status] = "In progress & on schedule", 2,
'ActiveCIP'[Status] = "Yet to commence", 3,
'ActiveCIP'[Status] = "Behind schedule", 4,
'ActiveCIP'[Status] = "No status", 5,
'ActiveCIP'[Status] = "Not Progressing", 6,
'ActiveCIP'[Status] = "Archive", 7
)
Alternatively, if all possible conditions (string values) of 'ActiveCIP'[Status] are listed in that code (values 1 through 7) then you can make the default result of the SWITCH be the result you want for BLANK values
StatusColourNum =
SWITCH(
TRUE(),
'ActiveCIP'[Status] = "Completed", 1,
'ActiveCIP'[Status] = "In progress & on schedule", 2,
'ActiveCIP'[Status] = "Yet to commence", 3,
'ActiveCIP'[Status] = "Behind schedule", 4,
'ActiveCIP'[Status] = "No status", 5,
'ActiveCIP'[Status] = "Not Progressing", 6,
'ActiveCIP'[Status] = "Archive",7,
8
)
Regards
Phil
Proud to be a Super User!
User | Count |
---|---|
98 | |
91 | |
84 | |
72 | |
67 |
User | Count |
---|---|
114 | |
103 | |
100 | |
72 | |
64 |