Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
102 | |
53 | |
21 | |
12 | |
12 |