Forum Discussion
Limit Dimension Data based on Fact Table in Power Query
- 4 years ago
Ok. Your current query setup won't allow query folding.
Can you try connecting without using an explicit SQL statement please?
Connect to the DB again, and leave the SQL statement blank:
Just hit OK, then select your dim_employee table from the table list and import.
Assuming this goes as planned, select the [EMPNO] column in your new dimension table and filter just one value. This should be fast to implement and sets us up a new step with the correct structure.
Edit that new step in the formula bar, so it uses our streaming list filter, something like this:
= Table.SelectRows( previousStepName, each List.Contains( List.Buffer( factTableName[EMPNO] ), [EMPNO] ) )This setup should allow PQ to stream the [EMPNO] values from your Excel source into the SQL native query sent to the SQL source for your dim_employee table.
Pete
- 4 years ago
Hi Anonymous ,
If you right-click your #"Filtered Rows" step, is 'Native Query' now selectable, or is it still greyed-out?
If it's still greyed out, try changing one of the column data types to the same type, but not a text column. For example, change a date type column to date type, or a decimal type column to decimal. This is purely to force PQ to re-evaluate the query and hopefully force it to generate a native query to source.
If native query IS selectable, then you're probably at the limit of optimisation. The Oracle Data Access Client (ODAC) requirement isn't the best in this regard.
Pete
Pete
It should be super fast. I use this method all of the time against SQL Server and it folds. Using List.Contains To Filter Dimension Tables — ehansalytics
Are you getting an IN operator in the folded statement to your server? What is the backend?
hi edhans
My Fact Table is excel based source and Dimension is Oracle table.
May be it works fine for Relational data sources but it is extremely slow. Can you share a sample file where you have implemented the above , just in case I am missing anything?
- edhans4 years agoCommunity Champion
I cannot provide a sample file because it was connected to my instance of SQL Server. If you install SQL Server and the Contoso or AdventureWorks sample databases, you can test the code in my blog post I linked to.
On the Oracle issue, I have seen VERY SLOW query performance with Power BI and Oracle, even when it folds, and I 100% blame the horrible Oracle driver Power BI uses. Clearly Power BI can do this as it works great with SQL and Snowflake databases, and clearly Oracle is a good RDB, but Power BI+Oracle is a substandard mix.
So much so I have a client that used to use Oracle as their datawarehouse and are now moving everything to SnowFlake because it offers superior performance with Power BI.