Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, column names and their contents can be used as wildcards to search for strings in other columns in Power Query.

To use this feature, you can create a custom function that takes the column name and the search string as inputs, and then dynamically generate a filter expression that targets the specified column.

For example, the following code searches for all rows where the "Product" column contains the string "apple", using the "Product" column name as a wildcard:

let Source = Excel.CurrentWorkbook(){[Name="SalesData"]}[Content], SearchString = "apple", FilterExpression = "= Text.Contains([" & Product & "], """ & SearchString & """)", FilteredRows = Table.SelectRows(Source, each Expression.Evaluate(FilterExpression, #table({Product}, {{[Product]}}))) in FilteredRows

Note that this code assumes that the data is stored in an Excel table named "SalesData", and that the "Product" column exists in this table. You'll need to adjust the code accordingly for your specific data source and column names.