Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

The Query contains the "XXXX" parameter, which is not declared.



I am trying to use "Paginated Report" on top of Power BI dataset. My dataset is a "Direct Query" connection on Azure datalake.


In order to create Paginated report with parameters, while creating dataset, I am using the query obtained through "Performance Analyzer" as shown below:


// Direct Query

MEASURE 'FactVolume'[ASDQ_GRs] = [Gross Receipts]
MEASURE 'FactVolume'[ASDQ_CCAs] = [CCA]

var ASDQ___DS0FilterTable3 = TREATAS({@KPI}, 'DimMeasures'[Measure Name])
var ASDQ___DS0FilterTable4 = TREATAS({"Treatment"}, 'Product'[Level 4 A])
"GRs", [ASDQ_GRs]


'DimDate'[Date] DESC


I have created the parameter in "Query Parameters". In spite of declaring the parameter, I am constantly receiving below error:

"OLEDB or ODBC error: The Query contains the 'KPI' parameter, which is not declared.


What am I doing wrong? Do "Parameters" work with Power BI dataset connection which are of type "Direct Query"? 


Can you please help me to resolve this issue? Thank you so much.





Helper II
Helper II

Hello Janey - Yes, I am using DQ mode as data volume is pretty high and Import option will not work for me. But "Measure Name" is not a calculated column in power BI. In fact, this column directly comes from underneath tabular model itself.

Hi, @nilimarodrigues 


According to your later description, your code seems to be no problem, it's so strange. I'm sorry not to help you to solve it. 


Do you mean [measure name] is a column? If it is a column created in the model, it is not a real column.


Best Regards

Janey Guo

Helper II
Helper II

Hello - Can some one please help with how can I proceed with resolving this issue?


Just to add - I just tried another dataset which have had "Import" connection and that worked fine. Is there a limitation on using parameters with direct connection?

Hi, @nilimarodrigues 


I found that you used the 'treatas' function in the code expression. The following parameter must be one or more existing columns. It cannot be an expression. So it can't recognize KPI, not DQ problem. You need to convert measure to column.


Reference: TREATAS function - DAX | Microsoft Docs

If it doesn’t solve your problem, please feel free to ask me.


Best Regards

Janey Guo


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

Hi v-janeyg-msft


Sorry for the late reply but measure name is not a "Measure" its a column. Its a characteristic field. It has values like KPI1, KPI2 etc.


I am not using TREATAS on a measure.




Hi, @nilimarodrigues 


You need to modify the first line of code and make it comply with the rules of use of the TREATAS. It doesn't seem to support parameters.



Best Regards

Janey Guo


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

Please refer to below youtube video (At 12:00 Min in video) from "Guy in cube" wherein he did use parameter for TREATAS.


Are you suggesting that TREATAS function was supporting parameters up until one point of time and just not able to support it now? 

Hi, @nilimarodrigues 


You said you use DQ mode and 'DimMeasures'[Measure Name] should be a calculated column, so I think this is a conflict.


Can you change it to import or turn the calculated column into a column then try it?


Best Regards

Janey Guo


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

Helpful resources

PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.