Forum Discussion
Update a slicer dropdown list with a value passed through parameters
To dynamically update a slicer dropdown in Power BI based on a parameter passed through the URL, you can follow these steps:
Create a parameter in your Power BI report:
- In Power BI Desktop, go to the "Model" view.
- Click on "New Parameter" in the "Calculations" group.
- Name the parameter something meaningful, like "SelectedItem."
- Set the data type of the parameter to Text.
- Optionally, you can specify a list of allowed values for the parameter if you want to restrict the choices.
Create a slicer based on the Item field:
- In the "Fields" pane, select the field that represents the items you want to filter.
- Drag and drop it into the "Slicer" visual on your report canvas.
Configure the slicer to use the parameter:
- In the "Visualizations" pane, select the slicer visual.
- In the "Format" section, expand the "Data" category.
- Set the "Default Value" property to your parameter (e.g., [SelectedItem]).
Create a custom table to display the selected item:
- In your report, add a new table visual.
- In this table, include the fields you want to display for the selected item.
- Use DAX measures and functions to filter this table based on the parameter. For example, you can use the following DAX measure to filter the table based on the selected item:
FilteredTable = FILTER('YourItemTable', 'YourItemTable'[ItemField] = [SelectedItem])
Replace 'YourItemTable' with the actual name of your Item table and 'YourItemField' with the name of the field representing the items.
Set up URL parameters:
- When you open your Power BI report from Microsoft Business Central, pass the selected item as a parameter in the URL. For example:
https://app.powerbi.com/groups/<workspace_id>/reports/<report_id>/ReportSection1?SelectedItem=123
Replace <workspace_id> and <report_id> with your actual Power BI workspace and report IDs, and set the SelectedItem parameter to the item you want to display.
Now, when you open the report with the URL parameter, it should select the specified item in the slicer dropdown, and the custom table should display data for that selected item. Make sure to adjust the table visuals, DAX measures, and field names to match your specific report setup.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Very late to the party, but I just want to set the selected value of the slicer to a particular value and have the tables and graphs respond to its value as they normally do when it starts up. This is a complicated page with other slicers and bookmarks already. Will the first part of you response, steps 1 through 3, do that? I'm looking to splice onto an existing code base and rewriting it will cost a bundle of money.