Forum Discussion
Change slicer fields based on a different slicer selection
To achieve this functionality in Power BI, you can create a dynamic measure slicer that changes based on the selection in the first slicer. Here's how you can do it step by step:
---
Step 1: Create a Field Parameter for the Second Slicer
1. Go to the **Modeling** tab in Power BI and click on **New Parameter** > **Fields**.
2. Create two field parameters:
- **Comparison1**: Includes `PriorDayUnits`, `PriorWeekUnits`, `PriorMonthUnits`, `PriorYearUnits`.
- **Comparison2**: Includes `PriorDayGrossSales`, `PriorWeekGrossSales`, `PriorMonthGrossSales`, `PriorYearGrossSales`.
---
Step 2: Create a Measure to Dynamically Switch Between Field Parameters**
Create a measure that dynamically selects the appropriate field parameter based on the selection in the first slicer (`TotalUnits` or `TotalGrossSales`).
```DAX
DynamicComparison =
SWITCH(
SELECTEDVALUE('DynamicMeasure'[Measure]), // Replace 'DynamicMeasure' with the name of your first slicer table
"TotalUnits", SELECTEDVALUE(Comparison1[Comparison1]),
"TotalGrossSales", SELECTEDVALUE(Comparison2[Comparison2])
)
```
---
Step 3: Create the Second Slicer**
1. Add a slicer to your report.
2. Bind the slicer to the **DynamicComparison** measure.
3. This slicer will now dynamically show either the `Comparison1` or `Comparison2` options based on the selection in the first slicer.
---
Step 4: Configure Interactions Between Slicers**
1. Ensure that the first slicer (`TotalUnits` or `TotalGrossSales`) is connected to the second slicer.
2. Use the **Edit Interactions** feature in Power BI to control how the first slicer filters the second slicer.
---
Step 5: Test the Dynamic Behavior**
- Select `TotalUnits` in the first slicer, and the second slicer should display `PriorDayUnits`, `PriorWeekUnits`, `PriorMonthUnits`, `PriorYearUnits`.
- Select `TotalGrossSales` in the first slicer, and the second slicer should display `PriorDayGrossSales`, `PriorWeekGrossSales`, `PriorMonthGrossSales`, `PriorYearGrossSales`.
Thank you so much for your thorough answer. I have a few more questions:
1. I created the second slicer, how do I bind it to the **DynamicComparison** measure (Step3 - #2)?
2. How do I connect the first slicer to the second one (step4 - #1)?
3. Where do I find the **Edit Interactions** feature in Power BI (step4 - #2)?
- v-aatheeque1 year ago
Community Support
Hi morani ,
We haven’t heard back from you regarding our previous response and wanted to check if your issue has been resolved.
If it has, please consider clicking “Accept Answer” and “Yes” if you found the response helpful.
If you still have any questions or need further assistance, feel free to let us know — we're happy to help!Thank you!
- v-aatheeque1 year ago
Community Support
Hi morani ,
Has your issue been resolved? If a community member's response addressed your query, please consider marking it as Accepted Answer and click Yes if you found it helpful.
If you have any further questions, feel free to reach out.
Thank you for being a valued member of the Microsoft Fabric Community Forum!- v-aatheeque1 year ago
Community Support
Hi morani ,
We haven’t heard back from you regarding our previous response and wanted to check if your issue has been resolved.If it has, please consider clicking “Accept Answer” and “Yes” if you found the response helpful.
If you still have any questions or need further assistance, feel free to let us know — we're happy to help!Thank you!