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.

Hi @nilimarodrigues did you find a way to resolved this issue?

Helpful resources

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors