Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Varias condiciones

Hola, tengo problemas al crear condicionales, tengo las columnas de Carga (texto), tipo de entrega ( C, A, En blanco), y tengo que desarrollar 4 condicionales,   1) Si tiene carga (ya que puede est...
  • v-jingzhang's avatar
    3 years ago

    Hi Anonymous 

     

    Both Power Query and DAX can create a conditional column. 

     

    This is an example with Power Query M code. You can add a custom column with below code. 

    if [Carga] <> "" and [Delivery type] = "" then "Result A" else if [Carga] = "" and [Delivery type] = "" then "pendiente de ruteo" else if [Carga] <> "" and [Delivery type] = "C" then "facturado" else if [Carga] <> "" and [Delivery type] = "A" then "En preparación" else null

     

    And this is an example with DAX. 

    Result = 
    SWITCH(TRUE(),
    [Carga]<>"" && [Delivery type]="","Result A",
    [Carga]="" && [Delivery type]="","Result B",
    [Carga]<>"" && [Delivery type]="C","Result C",
    [Carga]<>"" && [Delivery type]="A","Result D",
    BLANK()
    )

     

    You can modify above code per your need. I don't understand Spanish well so my examples perhaps don't 100% match your need. 

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.