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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
StevenT
Resolver I
Resolver I

Creating a dynamic slicer

StevenT_1-1732228216763.png

 

Hi, I created a field parameter and on the left side are the 6 fields that I've set up.  On my right side is a filter ("Choose Track(s)").

I want that when the user clicks on each button, the description changes to "Choose Album(s)", "Choose Artist", etc.

I can create a measure that does that but I can't seem to create a way that changes the slicer to use the field as specified, when the user clicks a button 

I used a switch dax measure but that didn't help.  Here's my code

_Switch Slicer DD =
Switch(
        TRUE(),
        '_Switch 6 Metrics'[_Switch Slicer Sel]=1,('_Switch 6 Metrics'[_Switch Slicer Fields]),
        '_Switch 6 Metrics'[_Switch Slicer Sel]=2,Album[Album],
        '_Switch 6 Metrics'[_Switch Slicer Sel]=3,Artist[Artist],
        '_Switch 6 Metrics'[_Switch Slicer Sel]=4,Genre[Genres],
        '_Switch 6 Metrics'[_Switch Slicer Sel]=5,RecordLabel[Recordlabel],
        '_Switch 6 Metrics'[_Switch Slicer Sel]=6,PurchasedFrom[PurchasedFrom]
     )

The error I'm getting is that the fields that are in bold, are not recognized, unelss I aggregate them, which would not make sense in a slicer.

Any ideas on how to resolve this? My goal is to have one slicer on the page no matter which metric the user clicks on.

Thanks, Steven Taub


2 ACCEPTED SOLUTIONS
danextian
Super User
Super User

Hi @StevenT 

 

If you're meaning to change the slicer header, you can conditionally format it using a measure that responds to the selected value of the Parameter Order column.

 

Slicer Title = 
SWITCH ( SELECTEDVALUE ( Parameter[Parameter Order] ), 0, "Text", 1, "Text2" )

 

 

danextian_0-1732259973124.png

danextian_1-1732259986260.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

Anonymous
Not applicable

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.

vmengmlimsft_0-1732672671850.png

 

vmengmlimsft_1-1732672838343.png

 

 

 

 

Best regards,

Mengmeng Li

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Hi @StevenT ,

 

What do you want to do with the data source? If you want to use parameter to dynamically change data sources in visuals, you can refer to my reply in this post. Solved: Dynamic API call - Microsoft Fabric Community

 

 

Best regards,

Mengmeng Li

StevenT
Resolver I
Resolver I

Thanks for this.  I have been able to change the title with no difficulty, it's what I want to do with the data source, that I've run into a challenge.  
Any ideas about the data source?

Anonymous
Not applicable

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")

vmengmlimsft_0-1732260691104.png

 

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.

vmengmlimsft_1-1732260735245.png

vmengmlimsft_2-1732260750700.png

 

 

 

 

Best regards,

Mengmeng Li

danextian
Super User
Super User

Hi @StevenT 

 

If you're meaning to change the slicer header, you can conditionally format it using a measure that responds to the selected value of the Parameter Order column.

 

Slicer Title = 
SWITCH ( SELECTEDVALUE ( Parameter[Parameter Order] ), 0, "Text", 1, "Text2" )

 

 

danextian_0-1732259973124.png

danextian_1-1732259986260.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Actually I found a way to do it that didn't require much coding. Please take a look at this link and tell me what you think? It worked perfectly for me.
https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Power-BI-Power-BI-Create-Dynamic-Sl...

 

You lost me there. Weren't you already usnig field parameters as you said you created one and you just wanted the title/header in the second slicer to be dynamic?





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Creating the title was easy. The challenge I was having is that I wanted to take slicer one, let the user change the slicer values, and whatever is changed in slicer one, changes the values in slicer two.

Anonymous
Not applicable

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.

vmengmlimsft_0-1732672671850.png

 

vmengmlimsft_1-1732672838343.png

 

 

 

 

Best regards,

Mengmeng Li

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.