Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Condicionales

Hola, tengo una consulta

 

Tengo las siguientes columnas  ON HAND (Numero), ON ORDER(Numero), FECHA(Numero), SELL OUT(Numero), Semana(Numero) lo que necesito son las siguientes condiciones,

 

Siempre se tiene que cumplir para SELL OUT = 0,

 

Si On hand = 0 y On order se mantiene con respecto a las dos semanas anteriores arrojar comentario Transito Pegado.

Si On Hand es distinto a Cero y el On Order es 0 tiene que arrojar comentario Stock Fantasma.

Por ahora llevo esto de formula:

Status =
SWITCH(TRUE(),
'Historial Export'[Sell Out (unidades)]= 0 && 'Historial Export'[ON HAND] <> 0  && 'Historial Export'[ON ORDER] = 0, "Stock Fantasma",
'Historial Export'[Sell Out (unidades)]= 0 && 'Historial Export'[ON HAND] = 0 && XXXXXXXXXXXXXX  , "Tránsito Pegado",
BLANK()
)
 
Me falta esa condicion que esta con XXXXXXXXX que seria que el OO por ejemplo en la semana 50 es 1000 en la 49 es 1000 y en la semana 48 es 1000, ahi tendria que decir transito pegado.

 

 

 

Por ejemplo en este caso para producto 1  seria que el ON HAND es 0 y el ON ORDER se matiene en para cada semana, entonces necesito que esa condicional arroje el mensaje de Transito Pegado, y el caso de Stock Fantasma seria el caso que el ON HAND es distinto a Cero y el ON ORDER es 0, y para todas estas condiciones siempre tiene que cumplirse que el SELL OUT (UNIDADES) es 0 esto seria el caso del producto 2

  • Hi Anonymous ,

     

    Please try:

    Comment = 
    var _a = COUNTX(FILTER('Historial Export',[Product]=EARLIER('Historial Export'[Product])&&[Week]>=EARLIER('Historial Export'[Week])-2&&[Week]<=EARLIER('Historial Export'[Week])&&[ON ORDER]=EARLIER('Historial Export'[ON ORDER])),[ON ORDER])
    return SWITCH(TRUE(),
    'Historial Export'[Sell Out (unidades)]= 0 && 'Historial Export'[ON HAND] <> 0  && 'Historial Export'[ON ORDER] = 0, "Stock Fantasma",
    'Historial Export'[Sell Out (unidades)]= 0 && 'Historial Export'[ON HAND] = 0 && _a = 3, "Tránsito Pegado",
    BLANK()
    )

    Final output:

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Hi Anonymous ,

     

    Please try:

    Comment = 
    var _a = COUNTX(FILTER('Historial Export',[Product]=EARLIER('Historial Export'[Product])&&[Week]>=EARLIER('Historial Export'[Week])-2&&[Week]<=EARLIER('Historial Export'[Week])&&[ON ORDER]=EARLIER('Historial Export'[ON ORDER])),[ON ORDER])
    return SWITCH(TRUE(),
    'Historial Export'[Sell Out (unidades)]= 0 && 'Historial Export'[ON HAND] <> 0  && 'Historial Export'[ON ORDER] = 0, "Stock Fantasma",
    'Historial Export'[Sell Out (unidades)]= 0 && 'Historial Export'[ON HAND] = 0 && _a = 3, "Tránsito Pegado",
    BLANK()
    )

    Final output:

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.