Forum Discussion
MiffMaster
3 years agoRegular Visitor
Formula.Firewall: Please rebuild this data combination
So I have run into an issue that is causing some serious headache. Some Power Query M let
// Constants
_driver_ = "driver={PostgreSQL Unicode(x64)};",
_database_ = "server=MY_SERVER...
BA_Pete
3 years agoSuper User
Hi MiffMaster ,
If you're only using 'queryTable1' as a dynamic filter, then I'd suggest the following:
--1--
Put this part of your original query into its own query and disable load. Let's call it 'filterQuery':
let
// Constants
_driver_ = "driver={PostgreSQL Unicode(x64)};",
_database_ = "server=MY_SERVER_NAME;port=5432;database=MY_DATABASE",
_table1_ = "MY_DATABASE.MY_SCHEMA_1.MY_TABLE_1",
_table2_ = "MY_DATABASE.MY_SCHEMA_2.MY_TABLE_2",
// Query table 1
_Q1_ = "SELECT col_1, col_2, col_3 FROM " &_table1_,
#"Table 1" = Odbc.Query(_driver_ & _database_, _Q1_),
--2--
Create your 'queryTable2' as normal, removing any references to 'queryTable1'.
--3--
Now, on queryTable2, add a step that looks like this:
Table.SelectRows(
previousStepName,
each List.Contains(List.Buffer(filterQuery[col_2]), [col_A])
)
Power Query should stream your filterQuery[col_2] values to the queryTable2 source in the native query WHERE clause, so folding is maintained.
Pete