Forum Discussion
Calling TVF with parameter from slicer
- 9 months ago
Hi sriramanat ,
I know this feature can be a bit confusing at first. I can’t do a Teams call, but I’m happy to guide you through the steps as clearly as possible.
This is the official Microsoft article that explains exactly how to pass a slicer value into a SQL query or TVF using Dynamic M Query Parameters: Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn.
If you’re still having trouble after reviewing it, please share more details or a screenshot of your setup. That will help in resolving the issue.
Regards,
Yugandhar.
Hi sriramanat
In Power BI Desktop, go to Manage Parameters, New Parameter.
Name it something like EmployeeIdParam.
Set its type to Number.
Leave the default value blank or set a placeholder.
In Power Query, edit the query that calls the TVF:
SQLSELECT * FROM dbo.MyTVF(@EmployeeIdParam)Replace @EmployeeIdParam with the parameter you created.
Go to Modeling, New Parameter, Fields.
Choose your Employee table and select the EmployeeId column.
Bind this field parameter to your slicer.
Add a slicer visual for Employee Name.
Configure the slicer to update the parameter (via Dynamic M Query Parameters).
When the user selects an employee, Power BI will pass the EmployeeId to the TVF query and refresh the data.
This requires DirectQuery mode for the TVF source.
--------------------------------
I hope this helps, please give kudos and mark as solved if it does!
Connect with me on LinkedIn.
Subscribe to my YouTube channel for Fabric/Power Platform related content!
wardy912 Thank you for your reply.
I tried the steps. I am not able to replicate the exact steps. Is there anyway you can keep screenshots for all the steps!
Or, any doanloadable pbix file along with data models?
Or, is there anyway we can connect on Teams 🤔
- V-yubandi-msft9 months ago
Community Support
Hi sriramanat ,
I know this feature can be a bit confusing at first. I can’t do a Teams call, but I’m happy to guide you through the steps as clearly as possible.
This is the official Microsoft article that explains exactly how to pass a slicer value into a SQL query or TVF using Dynamic M Query Parameters: Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn.
If you’re still having trouble after reviewing it, please share more details or a screenshot of your setup. That will help in resolving the issue.
Regards,
Yugandhar.