Forum Discussion
Power Query folder combine -- file combining -- faster?
- 5 years ago
peterhui50 can you not use this:
=List.ContainsAny({"A".."Z"}, Text.ToList([Column1]))It returns true or false. It is case sensitive. So the "xxxxx" value returns false since it isn't in A-Z
Changing it to this returns Yes or No.
if List.ContainsAny({"A".."Z"}, Text.ToList([Column1])) then "Yes" else "No"And changing it to this is case insensitive.
if List.ContainsAny({"A".."Z", "a".."z"}, Text.ToList([Column1])) then "Yes" else "No" - 5 years ago
peterhui50 - post back with performance enhancements. I don't know how much more efficient a List.Contains with Text.ToList is vs a single if/then/else with Text.Contains, but it surely must be more efficient than 26 of them!
Thanks to mahoneypat for asking the right question. I was just thinking originally of a lot of data. Looking at the transformations should have been at the top of my list as well.
I use the heck out of List.Contains*() functions. Seems more versitile and faster than Table.SelectRows(), even when query folding against SQL Server.
- peterhui505 years agoHelper III
Thank you! I love this list.contains solutions. I've used it for various other queries and performance seemed to have improved.
I have to add conditions in here , but not sure what I've done wrong
The File_Code is "A" and FILE is "A1" ... I did a
if List.Contains({"A"},Text.ToList([Files_Code])) and List.Contains({"A1"},Text.ToList([FILES])) then "True" else "False"
how can it return TRUE???