Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to use SQL query criteria stored in a column to return data using a function or Table.SelectRows

I have following challenge: Say I have a table like this: Name Type Color Size A Shirt Red XL B Shirt Blue XXL C Pants Green L and a ta...
  • edhans's avatar
    edhans
    6 years ago

    Oh good grief ImkeF - duh!

     

    Thanks! So obvious. I was looking for something difficlut.

     

    Anonymous - the final formula for the filter is:

    = Table.AddColumn(
                #"Changed Type",
                "Custom", 
                each
                let 
                    varFilter = [Criteria]
                in
                    Table.SelectRows(Table, Expression.Evaluate("each" & varFilter, [_ = _]))
            )

     

    Here is the final link. I keep files in a different folder when they are solved. The above link will not work.

  • Anonymous's avatar
    Anonymous
    6 years ago

    Wow camargos88 edhans ImkeF  I usually never post questions on forums like this because I always thought it took days to get answers. You proved me wrong, less than 24 hours and I have some info to work with. I will try to apply your solutions to my actual case and let you know the outcome! Thanks!

  • edhans's avatar
    edhans
    6 years ago

    Glad to help Anonymous 

     

    Remember, everyone here is a volunteer. Sometimes stuff can take days, other times minutes. Always post. Even if you discover a workable solution first, you can get a different perspective here that might improve on your solution.