Forum Discussion
Parameter in Power BI report Builder
Hi All - I'm facing an issue where Report Builder connected to a Power BI Semantic Model is returning multiple rows.
To resolve this, based on this thread I created DAX from Performance Visualiser.
There is no mention of how to insert parameters in the above thread.
But using this thread I could find how to do it.
But when I follow it, I get the error saying the Parameter X is not defined.
I've looked at below solutions, but nothing works
Pass a Parameter to DAX Query Report Builder - Stack Overflow
Chris Webb's BI Blog: Power BI Report Builder And RSCustomDaxFilter
Re: The Query contains the "XXXX" parameter, which... - Microsoft Fabric Community
Dynamic Parameters in PBI Report Builder using a p... - Microsoft Fabric Community
Solved: Bug: Power BI Report Builder - Parameter Not Decla... - Microsoft Fabric Community
All I need is, if I'm using the DAX provided by Performance Analyser in the report builder, what is the syntax for that query to use Parameters.
Thanks
8 Replies
- ABD128Resolver II
Hello CeeVee33
When you copy DAX from Performance Analyzer into Power BI Report Builder for paginated reports, parameters are not automatically recognized from the DAX text. Even with correct DAX syntax (such as using TREATAS or RSCustomDaxFilter), Report Builder will display a “parameter not declared” error unless the parameter is manually created at the dataset level.
To use parameters with Performance Analyzer DAX:
Create the parameter as a Dataset Parameter (Dataset Properties → Parameters).
Map the dataset parameter to a Report Parameter.
Once mapped, you can reference the parameter in the DAX query using @ParameterName.
Just pasting Performance Analyzer DAX and adding @ParameterName won't work, since paginated reports do not detect parameters from DAX text. This is the expected behavior for paginated reports that use Power BI semantic models, which explains why the same DAX works in Power BI Desktop visuals but not in Report Builder unless the dataset parameter is explicitly defined.
Regards,
ABD.
- CeeVee33Advocate II
Thank you ABD128 for the response.
I did those steps, I believe it is mentioned in one of the links I pasted.
However, when I do the 3rd step of refrerencing the parameter in the DAX - I get below error.
The query contains the 'calendardate' parameter, which is not declared.
And I guess that is where I am stuck. All those links talk about using it as above, but still not successful at my end.
Also, someone said dont go into the query designer and just do it in the text editor of data set. I tried it too, but same error as above.
Someone said paste in design mode of query designer then hit the "@" sign on the top which is for parameter and add it. But then it does not appear in the DAX. So where did it go?
Any help is much appreciated.
- ABD128Resolver II
Hi CeeVee33
Thank you for confirming the steps. From your description, it doesn’t seem to be a DAX syntax issue or related to Performance Analyzer. The error "The query contains the 'calendardate' parameter, which is not declared" happens during validation, showing that Report Builder doesn’t recognize the parameter at the dataset level, even if it looks correctly set up in the UI. That’s why manually adding @calendardate, using TREATAS or RSCustomDaxFilter, or switching between Query Designer and text mode doesn’t fix it the parameter isn’t bound internally.
To fix this, try rebuilding the setup: delete the dataset and any related parameters, then recreate the report parameter (calendardate as Date/Time) and add it under Dataset Properties → Parameters with the mapping =Parameters!calendardate.Value. You can check the binding with a simple query like EVALUATE ROW("Test", @calendardate). If the error still shows up, it confirms the problem is with dataset parameter binding, not the DAX logic, and recreating the dataset is needed. Your approach is correct, but the main issue is the parameter isn’t recognized internally by the dataset.
Regards,
ABD
- v-karpurapudCommunity Support
Hi CeeVee33
Thank you for submitting your question to the Microsoft Fabric Community Forum, and thanks to ABD128 for offering helpful suggestions.
Could you let us know if the suggested solution resolved your issue?If you still need help, please share more details so we can assist you further.
Regards,
Microsoft Fabric Community Support Team.
- CeeVee33Advocate II
Hi v-karpurapud , ABD128 - I've got another urgent request come through, you know how it is.
I'll check this solution by end of the week and get back.
Thanks
- v-karpurapudCommunity Support
Hi CeeVee33
Thank you for the update. Looking forward to you response.
Regards,
Microsoft Fabric Community Support Team.
- CeeVee33Advocate II
Hi v-karpurapud and ABD128 I still not have had the chance to look at this solution.
I'll get to it soon. And let you know.
Thanks