Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ketchum
Frequent Visitor

Can't create relationships between Snowflake tables when using DirectQuery or Composite Models

👋 I'm bringing in a few very, very small dimension tables via Import mode and a single small and overly simply Fact table via DirectQuery.

 

I can define the relationships, make them the appropriate cardinality (1:many on this textbook simple dim/fact model) and active, but when I try to create any visualization that uses a field from the dim table and fact table, I receive an "Error fetching data for this visual: OLE DB or ODBC error: [Expression.Error] We couldn't fold the expression to the data source. Please try a simpler expression.."

 

I've also tried to bring all the dim and fact tables in via DirectQuery and get the same result, however if I bring all the tables in via Import mode, I can succesfully utilize the data model and relationship to build visualizations, etc.

 

When utilizing DirectQuery or Composite models, do relationships simply not work in Power BI? That seems crazy. I know there are DAX and M limitations with DirectQuery, but this error seems to render DirectQuery utterly useless? Surely I'm doing something wrong!

 

ketchum_1-1744815665740.png

ketchum_2-1744815681295.png

ketchum_3-1744815710847.png

 

 

ketchum_0-1744815554707.png

 

2 ACCEPTED SOLUTIONS
marcelsmaglhaes
Super User
Super User

Hi @ketchum 
This error typically occurs when Power BI tries to generate a SQL query that involves tables with different storage modes (Import and DirectQuery) and fails to perform query folding.

In other words, it cannot efficiently combine data from an Import-mode dimension table with a DirectQuery fact table through SQL. This doesn’t mean relationships don’t work — it just highlights the limitations of using Import and DirectQuery tables together in visuals, especially when Power BI can’t translate the visual into a valid backend SQL query.

You can try a work around: Use Dual storage mode instead of Import for your dimension tables

  • Right-click on the dimension table in the model

  • Select “Storage Mode” → Choose Dual

This allows the table to behave as either Import or DirectQuery depending on the context of the query, which often resolves join/folding issues in visuals.

You can try Enable the Performance Analyzer in Power BI to inspect the generated query and understand whether the issue is in the visual, the measure, or the data model.

Let me know what happens!


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



View solution in original post

Hi @ketchum,

 

Thank you for reaching out to Microsoft Fabric Community.

 

Thank you @marcelsmaglhaes for the prompt response.

 

You cannot change an Import-mode table to Dual directly, please remove the dimension table and re add it as DirectQuery, and then change its storage mode to Dual. This allows power bi to optimize execution and resolve many folding and join issues.

  • If you are using snowflake via ODBC, consider switching to the native Snowflake connector, it provides better support for DirectQuery and query folding.
  • Also use single-directional relationships where possible, try using the basic one 1:many relationships, avoid bidirectional filtering unless necessary.
  • Use Performance Analyzer, it helps to identify which part of the query is causing folding or performance issues.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thanks and regards,

Anjan Kumar Chippa

 

 

 

 

 

 

View solution in original post

7 REPLIES 7
marcelsmaglhaes
Super User
Super User

Hi @ketchum 
This error typically occurs when Power BI tries to generate a SQL query that involves tables with different storage modes (Import and DirectQuery) and fails to perform query folding.

In other words, it cannot efficiently combine data from an Import-mode dimension table with a DirectQuery fact table through SQL. This doesn’t mean relationships don’t work — it just highlights the limitations of using Import and DirectQuery tables together in visuals, especially when Power BI can’t translate the visual into a valid backend SQL query.

You can try a work around: Use Dual storage mode instead of Import for your dimension tables

  • Right-click on the dimension table in the model

  • Select “Storage Mode” → Choose Dual

This allows the table to behave as either Import or DirectQuery depending on the context of the query, which often resolves join/folding issues in visuals.

You can try Enable the Performance Analyzer in Power BI to inspect the generated query and understand whether the issue is in the visual, the measure, or the data model.

Let me know what happens!


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



Thanks for the response @marcelsmaglhaes. I'll give the Performance Analyzer a try.

 

I can't select/change the Storage mode on my dim tables that are currently brought in via Import mode on the composite model, but I can change it for the fact table that is brought in via DirectQuery:

 

ketchum_0-1744819437246.png

 

ketchum_1-1744819461317.png

 

 

Oddly, I get the same behavior (unable to utilize relationships to build visuals) if I bring all the dim/fact tables in via DirectQuery mode, too. So anytime DirectQuery is involved, I'm seeing issues.

 

😵💫

Just to show that I receive the same error when only utilizing DirectQuery:

 

ketchum_1-1744820442915.png

 

I saw errors "earlier" in the process than at the visual / report level, though. When creating the relationships on the DirectQuery model, Power BI couldn't validate the relationship (I also changed the Cross-filter direction to both in an attempt to try anything that might work):

 

ketchum_2-1744820516188.png

 

I didn't receive this error when everything was brought in via Import mode, it all just worked as-expected.

 

Hi @ketchum,

 

Thank you for reaching out to Microsoft Fabric Community.

 

Thank you @marcelsmaglhaes for the prompt response.

 

You cannot change an Import-mode table to Dual directly, please remove the dimension table and re add it as DirectQuery, and then change its storage mode to Dual. This allows power bi to optimize execution and resolve many folding and join issues.

  • If you are using snowflake via ODBC, consider switching to the native Snowflake connector, it provides better support for DirectQuery and query folding.
  • Also use single-directional relationships where possible, try using the basic one 1:many relationships, avoid bidirectional filtering unless necessary.
  • Use Performance Analyzer, it helps to identify which part of the query is causing folding or performance issues.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thanks and regards,

Anjan Kumar Chippa

 

 

 

 

 

 

Hi @ketchum,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution I have provided for the issue worked? or let us know if you need any further assistance.
If my response addressed, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

Hi @ketchum,

 

We wanted to kindly follow up to check if the solution I have provided for the issue worked.
If my response addressed, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

 

Hi @ketchum,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution I have provided for the issue worked.
If my response addressed, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.