Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to write a list objects in power query

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")

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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")
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading