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
BL123456
Frequent Visitor

OLE DB or ODBC error: [Expression.Error] We couldn't fold the expression to the data source

I'm encountering an issue with Power BI while using a custom connector to connect to ClickHouse via ODBC (with a direct query option).

 

When I select a column containing Unicode characters, everything displays correctly.

However, when I try to filter the data by selecting a specific value that contains Unicode characters, I receive the following error:

"OLE DB or ODBC error: [Expression.Error] We couldn't fold the expression to the data source. Please try a simpler expression".

 

 

Here is the error recorded.

 

I see that the forum has plenty of questions regarding this error, none of the suggested solutions worked for me. The closest question I found was asked in 2018, and it seems that it was solved internally.

 

My setup includes the April 2023 release of Power BI Desktop (version 2.116.966.0 x64), running on Windows 10 (version 10.0.20348.0 x64).

 

Initially, I suspected the issue might be related to a type mismatch between the ClickHouse ODBC connector and Power BI, especially since Unicode is involved. However, Power BI appears to have only one Text type, which should support Unicode characters without problems.

 

Any idea why PowerBI can't fold the query when using unicode chars? Should I add something specifically to the ClickHouse connector?

 

I'd appreciate any insights or suggestions for troubleshooting this issue.

Thank you in advance for your help!

2 REPLIES 2
Anonymous
Not applicable

Hi @BL123456 ,

 

I noticed that you used DirectQuery connection mode.

Some functions are not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules, such as COUNTROWS and ISFILTERED. This can lead you to errors like this.

COUNTROWS function (DAX) - DAX | Microsoft Learn

vstephenmsft_0-1726108551210.png

Similar post: Solved: We couldn't fold the expression to the datasource ... - Microsoft Fabric Community

 

Also, try upgrading Power BI Desktop to the latest version and see if this issue persists.

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @Anonymous 

 

Thank you for your reply.

The thing is the issue happens only for Unicode characters. I believe that in case we had an issue with the DAX function, it would have happened for all encodings.

 

Do you have another idea?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors