Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
hdvalerod
New Member

Update a slicer dropdown list with a value passed through parameters

Hello,

 

I have a PBI report with a Item master table and a sub table with Item Entries.

I open the report from a button in Microsoft Business central on the Items card page for the Item I'm viewing atm.

If I just open the URL, it will always show the last item viewed but I want to add a parameter to the URL so it knows what Item I want to see data for.


The report layout has a list at the bottom and a slicer button on top (dropdown style) to select the item you'd like to see below on the list.

Using something like &filter=items/number eq '123' will actually filter the list table but the value on the slicer button still shows the last item viewed.

 

I dont want to actually filter the report, I want to "select" the Item I want on the slicer through URL parameters. 

 

How can I achieve this?

 

Kind regards

3 REPLIES 3
123abc
Community Champion
Community Champion

To dynamically update a slicer dropdown in Power BI based on a parameter passed through the URL, you can follow these steps:

  1. 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.
  2. 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.
  3. 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]).
  4. 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])

 

  1. Replace 'YourItemTable' with the actual name of your Item table and 'YourItemField' with the name of the field representing the items.

  2. 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

 

  1. 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.

This method would be filtering the whole report and dataset not just selecting a value in a slicer, correct?

123abc
Community Champion
Community Champion

Apologies for the confusion. You are correct that the approach I outlined would filter the entire report based on the parameter value, rather than just updating the slicer selection.

To achieve the goal of updating the slicer selection based on a parameter passed through the URL without filtering the entire report, you can use Power BI's "Bookmarks" feature along with the "Buttons" feature. Here's how you can do it:

  1. Create a bookmark for each item in your slicer:

    • In Power BI, go to the "View" tab.
    • Click on "Bookmarks Pane" to open the bookmarks pane.
    • Create a bookmark for each item in your slicer. Each bookmark should have a different selection in the slicer.
  2. Create buttons for each item in your slicer:

    • Go to the "Home" tab.
    • Click on "Buttons" and create a button for each item in your slicer.
    • For each button, set the action to "Bookmark" and choose the corresponding bookmark created in step 1.
  3. Use a parameter to control which bookmark is selected:

    • Create a parameter (e.g., "SelectedItem") to hold the value passed through the URL parameter.
    • Write a measure that returns the bookmark name based on the parameter value.
  4. Set up a button action to select the bookmark dynamically:

    • For each button created in step 2, set the action to "Bookmark" and use the measure created in step 3 to dynamically select the appropriate bookmark based on the parameter value.

With this setup, when you pass a value through the URL parameter, the corresponding bookmark will be selected, effectively updating the slicer selection without filtering the entire report.

This method allows you to achieve the desired behavior of updating the slicer selection based on a parameter passed through the URL without filtering the entire report.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.