Forum Discussion
monojchakrab
4 years agoResolver III
How to replace OR condition in power query M
Hiya all, I am working with a piece of code as follows : Table.AddColumn(#"Rounded Off", "Active", each if Text.Contains([MATERIAL DESC],"GOLD") or Text.Contains([MATERIAL DESC],"GLD")
then...
- 4 years ago
Table.AddColumn(#"Rounded Off", "Active", each {"Not Relevant","Aspertame","Sucralose","Stevia","Half-Sugar"}{List.PositionOf({{"GOLD","GLD"},{"NATURA"},{"GREEN","GRN"},{"SUGARLITE"}},[MATERIAL DESC],0,(x,y)=>List.Contains(x,y,(x,y)=>Text.Contains(y,x)))+1) - 4 years ago
Hi monojchakrab ,
Missing a ")" in the syntax (after x[Case]).
Table.AddColumn(#"Added Custom2", "Custom", each try Table.SelectRows(LookupTable, (x)=> Text.Contains([MATERIAL DESC],x[Case]))[Return]{0}) otherwise "Not Relevant")
wdx223_Daniel
4 years agoCommunity Champion
Table.AddColumn(#"Rounded Off", "Active", each {"Not Relevant","Aspertame","Sucralose","Stevia","Half-Sugar"}{List.PositionOf({{"GOLD","GLD"},{"NATURA"},{"GREEN","GRN"},{"SUGARLITE"}},[MATERIAL DESC],0,(x,y)=>List.Contains(x,y,(x,y)=>Text.Contains(y,x)))+1)monojchakrab
4 years agoResolver III
Hi wdx223_Daniel - that one worked like a charm.
Would you mind stepping the logic out for me so that I could understand how exactly is the code working...that could help as a future reference for similiar situation in other files.