Forum Discussion
SSAS Tabular fails to process table with filter when using ODBC: Incorrect number of parameters
- 5 months ago
Hi VanThuan,
Thank you for reaching out to the Microsoft Fabric Community Forum. Also, thanks to ibarrau, for those inputs on this thread.
This behaviour is related to how SSAS Tabular handles query folding with ODBC sources. When you add a filter step in Power Query, the mashup engine tries to push that filter down to the data source by generating a parameterized SQL query (using ? placeholders). In your case, the Simba Trino ODBC driver expects parameter values but does not receive them correctly, which results in the “Incorrect number of parameters” error. Currently, there isn’t any setting in SSAS Tabular or Visual Studio to control or fix this parameter binding behaviour.
As a workaround, you can avoid this issue by either preventing query folding or by bypassing parameterization completely. The most reliable options are add Table.Buffer before applying the filter so the filtering happens locally instead of being pushed to Trino, or use a native SQL query via Odbc.Query with the filter written directly in SQL (e.g., WHERE client_id IN (4,5,6)), which avoids parameter placeholders entirely and usually provides better performance.Refer these links:
1. https://learn.microsoft.com/en-us/power-query/odbc-parameters
2. https://learn.microsoft.com/en-us/sql/odbc/microsoft/limitations?view=sql-server-ver17Hope that clarifies. Let us know if you have any doubts regarding this. We will be happy to help.
Thank you for using the Microsoft Fabric Community Forum.
Hi VanThuan,
Just checking in to see if the issue has been resolved on your end. If the earlier suggestions helped, that’s great to hear! And if you’re still facing challenges, feel free to share more details happy to assist further.
Thank you.
Hi VanThuan,
Just wanted to follow up. If the shared guidance worked for you, that’s wonderful hopefully it also helps others looking for similar answers. If there’s anything else you'd like to explore or clarify, don’t hesitate to reach out.
Thank you.