Skip to main content
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper III
Helper III

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 III
Helper III

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.

@nilimarodrigues Were you able to resolve this issue?

I created a Dataset DCOO for table DCOO field DCOO. Created a parameter in the model from it called DCOO. Automatically created a report parameter DCOO.

Attempted to create a Dataset called Contracts with  the parameter: DEFINED  the VAR for the query and set the parameter DCOO for DCOO on level DCOO for ALL. Getting the same NOT DECLARED message.


I have also tried setting the parameter on the Dataset Properties page of the Contracts Dataset after changing the VAR back to a constant (query runs fine) and then trying to change it back to parameter (Not Declared)

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 III
Helper III

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.

Not applicable

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

Helpful resources

July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.


Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.