Forum Discussion
Dynamic M Query Parameters not working when I make slicer selection
tmendoza I did a quick demo on my end, and everything is working as expected. Keep everything in context. I'm filtering the customer table on customerID, which is of the number type.
Step1 : Created a parameter called ParamCustomerID:
Step 2: Created a Direct Query Customer table, which will be filtered on the above parameter value:
let
Source = Sql.Database("MySQLServer", "MySQLDatabase", [Query="SELECT * FROM Customer WHERE CustomerId = " & Number.ToText(ParamCustomerID)])
in
Source
After saving the above query, it is filtering the customer table on the ParamCustomerID current value, and in this case, it is value 1
Step 3: Created another table, which is simple IDs and will be used for the slicer, and I called it CustomerSlicer with one column CustomerId:
Step 4: Close and apply (no error at this point)
Step 5: Bind to the parameter,
- go to model tab
- selected CustomerId column in CustomerSlicer table
- under Advanced -> Bind to parameter -> selected ParamCustomerID
Step 6: Added a slicer, and it using CustomerId column from CustomerSlicer table
Step 7: Added a table visual that has two columns from the Customer table, and it is getting filtered as the slicer value is selected.
parry2k ,
Thanks for your response.
We have a similar set up, period and customer ID are both numeric.
I followed your steps to the tee and I can see the Power Query editor working and loading the data correctly.
The visual also works when there is no slicer selection.
However, once making a slicer selection with the bound parameter, I'm running into this error message:
Any idea what it could mean?
At this point, I feel like this should have worked by now. Is it possible that there is a dashboard setting that I need to toggle to make the M Query parameter work?