Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello, I want to do something like this:
#"Colonne conditionnelle ajoutée" = Table.AddColumn(#"Type modifié", "New colonn", each if Text.Contains([colonne1], "xxx") then "x" else if Text.Contains([colonne1], "xxxy") then "x" else if Text.Contains([colonne1], "xxxd") then "x" else if Text.Contains([colonne1], "xxxg") then "x" else null). This code work well. But I have a lot of modalities and I want to use other code like this
#"Colonne conditionnelle ajoutée" = Table.AddColumn(#"Type modifié", "New colonn", each if Text.Contains([colonne1], "xxxx" or "xxxd" or "xxxg" or "xxxy") then "x" else null). It not working well and I need help to find the right code. Thanks a lot for your help
Solved! Go to Solution.
#"Colonne conditionnelle ajoutée" = Table.AddColumn(#"Type modifié", "New colonn", each if List.Contains({"xxx","xxxy","xxxd","xxxg"},[colonne1],(x,y)=> Text.Contains(y,x)) then "x" else null)
#"Colonne conditionnelle ajoutée" = Table.AddColumn(#"Type modifié", "New colonn", each if List.Contains({"xxx","xxxy","xxxd","xxxg"},[colonne1],(x,y)=> Text.Contains(y,x)) then "x" else null)
Your code contains all the right elements, but this is exactly the one that works.
#"Colonne conditionnelle ajoutée" = Table.AddColumn(#"Type modifié", "New colonn", each if List.Contains({"xxx","xxxy","xxxd","xxxg"},[colonne1]) then "x" else null)
I know you used ,(x,y)=> Text.Contains(y,x)) for the explanations. Thank you so much
my code will give a "x" when [colonne1]="2123xxx212" or "zzzxxxydd", as long as it contains any string in the list.