Forum Discussion
Unable to use parameter in query2 which uses query1 to get parameter values
The error message you're receiving indicates that the syntax in your query is incorrect. Specifically, the issue seems to be with how you're using the parameter in the WHERE clause of query2.
Here are a few things you can try:
Double-check the syntax of your query to ensure that the parameter reference is correct. It should be in the format: @Parameter1.
Make sure that the data type of the parameter matches the data type of the column you're comparing it to in the WHERE clause.
Verify that the parameter is being populated correctly by running query1 separately and checking the values returned.
Try using the "Advanced Editor" in Power Query to manually edit the M code for query2 and ensure that the parameter reference is correctly formatted.
If none of these solutions work, try breaking down the query into smaller steps to isolate the issue. You may be able to identify the problem by testing each part of the query separately.
Hopefully, one of these solutions will help you resolve the issue and use your parameter successfully in query2.