Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi all,
is is possible to pass a parameter to a DAX Query inside an AnalysisServices.Database() statement?
I have a Query like this:
= AnalysisServices.Database("Servername", "Databasename", [Query="DEFINE VAR ParamYear = 2014 EVALUATE ......... , Implementation="2.0"])
And I want to add a parameter "=@Year" to this query instead of inserting it like "=2014" as above. I already defined in PowerBI a parameter "Year" . How is it possible to pass the Power BI Year Parameter to the Query?
I want to avoid to query everything in the first step and set the filter in the second step, if it would be already possible to pass the parameter directly to this Query.....
Solved! Go to Solution.
Hello @VerenaS
this record-field "Query" takes a text. So cou can hardcode it or use a parameter. Here an example how it could look like
ParYear = "2014"
GetAnalysis = AnalysisServices.Database("Servername", "Databasename", [Query="YourQuerText Year=" & ParYear & " EVALUATE ........." , Implementation="2.0"])
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello @VerenaS
this record-field "Query" takes a text. So cou can hardcode it or use a parameter. Here an example how it could look like
ParYear = "2014"
GetAnalysis = AnalysisServices.Database("Servername", "Databasename", [Query="YourQuerText Year=" & ParYear & " EVALUATE ........." , Implementation="2.0"])
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Thanks a lot for your help, Jimmy!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
13 | |
9 | |
8 | |
7 |
User | Count |
---|---|
17 | |
10 | |
7 | |
6 | |
6 |