Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Syndicate_Admin
Administrator
Administrator

¿Cómo puedo excluir valores de la condición IF?

Tengo las siguientes columnas en mi conjunto de datos. Mi código es

IF(AND(TABLE[Value]>Table[Min], Table[Value]
< ode="">

It checks value is between min/max and outputs in limits otherwise OOL (out of limits). However, some of my min/max values have an "NA" value instead of a number so returns error when I try doing comparisons with a number. Is there any way to just output "NA" instead of OOL/In Limits when either min or max value is "NA"?

XYZ1233_0-1648538007390.png

1 ACCEPTED SOLUTION

@XYZ1233 , creo que debido al tipo de datos variable. Idealmente, debe hacer que todos los valores no numéricos sean nulos en power query, para que la columna pueda tener un tipo de datos numéricos

sigue intentando esto

CL OOL =
SWITCH (True(),
Tabla[Min]="NA","NA",
Panel_1[Max]= "NA", "NA",
ISBLANK(Panel_1[Min]),"NA",
AND(Panel_1[Valor]*1>Panel_1[Min]*1,Panel_1[Valor]*1

View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

@XYZ1233 , Pruebe una nueva columna como

Switch(True() ,
Tabla[Valor] = "NA", "NA",
isblank(Table[Value]) , "NA",
AND(TABLE[Value]>Table[Min], Table[Value]

, "OOL")

¿ @amitchandak

Probé el siguiente código (son las columnas min/max las que tienen valores NA, no la columna Valor)

CL OOL = 
SWITCH (True(),
Table[Min]="NA","NA",
Panel_1[Max]= "NA", "NA",
ISBLANK(Panel_1[Min]),"NA",
AND(Panel_1[Value]>Panel_1[Min],Panel_1[Value]< ode="">

but it gives same error as before, "DAX comparison operations do not support comparing values of type Number with values of type Text." Last time, I had "NA" in my value column instead of Min/Max columns and used the below code (the or condition with index 91/92/93 etc... is just to exclude certain rows ). Is there a way to adapt the below code for the min/max columns instead of the value column? Thanks

CL OOL = 
SWITCH (
    TRUE (),
    AND (
        IFERROR ( VALUE ( Panel_1[Value] ), "Not Running" ) >= Panel_1[Min],
        IFERROR ( VALUE ( Panel_1[Value] ), "Not Running" ) <= Panel_1[Max]
    )
        || Panel_1[Index] IN { 91, 92, 93, 94, 95, 96, 97, 98 }, "In Limits",
    IFERROR ( VALUE ( Panel_1[Value] ), "Not Running" ) = "Not Running", "Not Running",
    "OOL"
)

@XYZ1233 , creo que debido al tipo de datos variable. Idealmente, debe hacer que todos los valores no numéricos sean nulos en power query, para que la columna pueda tener un tipo de datos numéricos

sigue intentando esto

CL OOL =
SWITCH (True(),
Tabla[Min]="NA","NA",
Panel_1[Max]= "NA", "NA",
ISBLANK(Panel_1[Min]),"NA",
AND(Panel_1[Valor]*1>Panel_1[Min]*1,Panel_1[Valor]*1

Gracias @amitchandak ,

Eso funciona. ¿Sabes dónde puedo insertar esta línea de la respuesta anterior? Quiero que estos siempre se muestren en Límites. Gracias por el consejo también, pondré valores como nulos en su lugar la próxima vez.

|| Panel_1[Index] IN { 91, 92, 93, 94, 95, 96, 97, 98 }, "In Limits",

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.