Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

SelectRows on Dynamic columnname

Hi,

 

I would like to filter rows from a table based on a value in different columns. Here's an example of a table where I want to get the yellow column as extra column (or at least, the yellow column shows if the row must be in the selection);

 

 

So the column with the filter is based on a fiel value...  Not shure if this is possible at all, maybe something like this:

 

= Table.SelectRows(#"Last Step", each [VALUE IN Filtercolumn] = [VALUE IN Filtervalue])

 

Thanx in advance!

  • Use below formula in a custom column

    if Table.ColumnNames(Source){List.PositionOf(List.Range(Record.ToList(_),0,3), [Filtervalue])} = [Filtercolumn] then "Yes" else "No"

4 Replies

  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    Most Valuable Professional

    Use below formula in a custom column

    if Table.ColumnNames(Source){List.PositionOf(List.Range(Record.ToList(_),0,3), [Filtervalue])} = [Filtercolumn] then "Yes" else "No"
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanx fot your answer! I get the message that a value of type Record can't be converted to type Table (translated)... Value=[Record] Type=[Type].

      • Anonymous's avatar
        Anonymous
        Not applicable

        I had to change Source to the right language.. sorry, but the result is now 'No' on each row.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanx! thanx! thanx a lot. Got it working now. Great!