Forum Discussion
Anonymous
4 years agoNot applicable
How can I fix this error in DAX code?
The below is a column created with DAX, which checks whether the value in the "Value" column is more than the "Min" column and less than the "Max" column, and will will display "In Limits" if this is...
- 4 years ago
Anonymous , Try this one:-
CL OOL = SWITCH ( TRUE (), AND ( IFERROR ( INT ( Panel[Value] ), "Not Running" ) >= Panel[Min], IFERROR ( INT ( Panel[Value] ), "Not Running" ) <= Panel[Max] ) || Panel[Index] IN { 91, 92, 93, 94 }, "In Limits", IFERROR ( INT ( Panel[Value] ), "Not Running" ) = "Not Running", "Not Running", "OOL" )
Anonymous
4 years agoNot applicable
Hi Samarth_18 ,
Your code gave this error: "Cannot convert value 'NA' of type Text to type Number". My Value column has type text because it holds both numbers and "NA" values.
Samarth_18
4 years agoCommunity Champion
Anonymous ,Pls try now:-
CL OOL =
VAR result =
IF (
AND ( INT ( Panel[Value] ) >= Panel[Min], INT ( Panel[Value] ) <= Panel[Max] )
|| Panel[Index] IN { 91, 92, 93, 94 },
"In Limits",
"OOL"
)
RETURN
IFERROR ( result, "Not Running" )
- Anonymous4 years agoNot applicable
Thanks Samarth_18 ,
It still seems to return the same error though. Here is a picture of some of my data if it helps.
- Samarth_184 years agoCommunity Champion
Anonymous , Try this one:-
CL OOL = SWITCH ( TRUE (), AND ( IFERROR ( INT ( Panel[Value] ), "Not Running" ) >= Panel[Min], IFERROR ( INT ( Panel[Value] ), "Not Running" ) <= Panel[Max] ) || Panel[Index] IN { 91, 92, 93, 94 }, "In Limits", IFERROR ( INT ( Panel[Value] ), "Not Running" ) = "Not Running", "Not Running", "OOL" )- Anonymous4 years agoNot applicable
Thanks, it works now!