Forum Discussion
Creating Dynamic Slicers for Stacked Bar Charts with Multiple Components and Plant Selection
Hello, I am having difficulties in creating a slicer to select the fields that can be displayed on a stacked bar chart. The visual I want to display has four components: overhead cost, fixed cost, variable cost, and depreciation cost. I have watched videos and discussions suggesting the use of a field parameter, but I haven't figured out how to apply it to my data. I want users to be able to choose which fields to display in the stacked bar chart by selecting the corresponding slicer. For example, if the user selects fixed and variable costs, the slicer will reflect that choice and the stacked bar chart will display the appropriate visual. My confusion arises from the fact that the field parameter contains the same fields as the y-axis, whereas most tutorials use different fields for the field parameter and the y-axis. Also, I plan to display visuals for three plants, each with its own table containing the same column components. The three tables are connected using the key 'period.' Here is an attachment of the tables and my desired visualization (not working yet). In addition to my question about the field parameter mentioned above, what would be an efficient approach to displaying the field slicer and plant slicer? I am considering using the bookmark feature, but if so, do I need to add all four fields from each table to the field parameter slicer (resulting in 12 fields with 4 unique values)? Please assist me. Thank you in advance.
1 Reply
- amitchandak
Super User
mrfsca , You have to create 4 measures that switch measures based on plat selection on top of that you have to create a field parameter.
M1 = Switch(Max(Table[Plant]) ,
"Plant 1" , [M1 Plant1] , // assume you already have that measure or use calculation
"Plant 2" , [M1 Plant2] , // assume you already have that measure or use calculation
"Plant 3" , [M1 Plant2] ) // assume you already have that measure or use calculation
Have such measures m1, m2, m3, m4 and then use them in Field parameters
Power BI Field Parameters — A Quick way for Dynamic Visuals: https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9afd
Power BI Field Parameters- Measure Slicer and Axis/Dimension slicer: https://youtu.be/lqF3Wa1FllE
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f