Forum Discussion
Creating a dynamic slicer
- Anonymous1 year ago
Hi StevenT ,
Do you want to select column names in Slicer1 and show values of selected column in Slicer2?
If so, please refer to the method in message 3, that may be what you want.
Best regards,
Mengmeng Li
Hi StevenT ,
I'm afraid you'll need to create a custom table for dynamic slicer, because in Power BI, slicers are typically used to filter data, and they're mostly used with column fields, not measures. The measure is the result of a dynamic calculation and cannot be used directly as a field in the slicer.
1. Use Union to combine all the columns in the parameter and their corresponding order into a new table.
Table 2 = DISTINCT(UNION(ADDCOLUMNS(SELECTCOLUMNS('Album',"Field",'Album'[Album]),"Order",0),ADDCOLUMNS(SELECTCOLUMNS('Artist',"Field",'Artist'[Artist]),"Order",1)))
//Add other fields as Album and Artist.
2. Add "one to many" relationship between parameter and custom table.
3. Use "Field" column in dynamic slicer. Then the slicer will show selected column values when you select parameter slicer.
4. If you want dynamic slicer to filter origianl tables, you can create relationships between them.
5. For the changed title of dynamic slicer.
Measure = SWITCH(SELECTEDVALUE(Parameter[Parameter Order]),0,"Choose Album",1,"Choose Artist")
Here is my test and attached pbix file for your reference. I am showing value of Table[Date] and Table(2)[Test1] in dynamic slicer.
Best regards,
Mengmeng Li