Forum Discussion

AllanBerces's avatar
AllanBerces
Icon for Post Prodigy rankPost Prodigy
1 year ago
Solved

Switch

Hi good day can anyone help me on my new column base from my table below, basically if the comments is Cancelled and Tobe- Cancelled the actual colunm should reflect Non-Workable.

OUTPUT

 

Thank you

  • Houston-ho's avatar
    Houston-ho
    1 year ago

    Actual = SWITCH(Test[Comment], "Cancelled", "Non-Workable", "Tobe-Cancelled", "Non-Workable", Test[Status])

     

  • AllanBerces 

     

    Just add [Status] like this

     

     

    Actual = 
    
    SWITCH(
    
    TRUE(),
    
    [Comments] = "Cancelled" || [Comments] = "Tobe- Cancelled" , "Non-Workable",
    
    [Status]
    
    )

     

     

    regards

     

    Phil

6 Replies

  • AllanBerces 

     

    What about the other values in the column like Not Started, Completed, In Progress?

     

    You can use IF or SWITCH 

     

     

    Column = IF([Comments] = "Cancelled" || [Comments] = "Tobe- Cancelled" , "Non-Workable")

     

     

     

    Column = 
    
    SWITCH(
    
    TRUE(),
    
    [Comments] = "Cancelled" || [Comments] = "Tobe- Cancelled" , "Non-Workable"
    
    )

     

     

    Regards

     

    Phil

    • AllanBerces's avatar
      AllanBerces
      Icon for Post Prodigy rankPost Prodigy

      Hi PhilipTreacy thank you for the quick reply and for the Actual will copy the word is status column as long its not Cancelled and Tobe- Cancelled in comment column. 

      • Houston-ho's avatar
        Houston-ho
        Icon for Advocate I rankAdvocate I

        Assumed the table named "Test", add a column with DAX,

        Actual = SWITCH(Test[Comment], "Cancelled", "Non-Workable", "Tobe-Cancelled", "Non-Workable", Test[Comment])
  • AllanBerces 

     

    Just add [Status] like this

     

     

    Actual = 
    
    SWITCH(
    
    TRUE(),
    
    [Comments] = "Cancelled" || [Comments] = "Tobe- Cancelled" , "Non-Workable",
    
    [Status]
    
    )

     

     

    regards

     

    Phil