Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

Select all rows of a column with Table.SelectRows function in PowerQuery Editor

Hi Everybody,

 

I have recently opened this thread in order to find whether there is the possibility to select every rows of a column, according to multiple conditions.

 

I'll explain here.

Suppose we have this conditions applied:

let
    Origine = Odbc.DataSource("dsn=BBB", [HierarchicalNavigation=true]),
    admin_Database = Origine{[Name="AAA",Kind="Database"]}[Data],
    admin_Schema = admin_Database{[Name="AAA",Kind="Schema"]}[Data],
    View= admin_Schema{[Name="bs_cono_abi",Kind="Table"]}[Data],
    FilteredTable = Table.SelectRows(View, each ([A] = ABI_ALIAS) and ([B] = "someuser") and ([C] = ENV_ABI))
in
    FilteredTable

 

 

Columns A and C are filtered through parameters (and they will be constant over time) ABI_ALIAS and ENV_ABI, and those are ok, while column B should be filtered accepting all the rows contained in it; you could point out the fact that I could easily reach my objective avoiding that column to be inserted in the script, but i am forced to pass all columns, A, B, and C, in order to allow table to be correctly evaluated from PowerBI.

 

So, I would like to know whether there's a proper way to reach this particular target.


Thanks in advance,

Damiano

2 Replies

  • Anonymous , Based on what I got

    . You can use the Table.AddColumn function to create a new column that duplicates the values from column B and then filter it based on your conditions.

     

    Power BI- Power Query Table.AddColumn- https://youtu.be/dEDK4wktAME

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi amitchandak, that's not the solution, I need to filter that column, so I need a condition that specify "Filter column B taking everything in it", a sort of Select All.

       

      Is there any script?

       

      D