Forum Discussion

VanThuan's avatar
VanThuan
Frequent Visitor
5 months ago
Solved

SSAS Tabular fails to process table with filter when using ODBC: Incorrect number of parameters

Hi Community, I'm experiencing an issue with SSAS Tabular (Visual Studio) when connecting to a data source via ODBC driver (Simba Trino). Environment - Visual Studio with SSAS Tabular project - O...
  • v-kpoloju-msft's avatar
    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-ver17

    Hope 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.