I would like to create a list object to contain specific ID numbers ? How to write the code below more efficient ? many thanks in advance.
#"Added Conditional Column" = Table.AddColumn(#"Added Custom", "new col name",
each if [Col1] = "10011130" then "bla1" else if [Col1] = "10013030" then "bla1"
else if [Col1] = "10014030" then "bla1" else if [Col1] = "10015030" then "bla1"
else if Text.Contains([Col2], "bla2") then "bla2"
else "bla3")
what I tired
#"Added Conditional Column" = Table.AddColumn(#"Added Custom", "new col name",
each if [Col1] = {"10011130", "10013030", "10014030", "10015030"} then "bla1"
else if Text.Contains([Col2], "bla2") then "bla2"
else "bla3")
Try this:
#"Added Conditional Column" = Table.AddColumn(#"Added Custom", "new col name",
each if List.Contains({"10011130", "10013030", "10014030", "10015030"} ,[Col1] ) then "bla1"
else if Text.Contains([Col2], "bla2") then "bla2"
else "bla3")