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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

PowerBI JSON Theme Slicer Default Mode to Dropdown

Hello,

I am working on a JSON Theme file to make creating a reports front end more streamline. However, I am having diffcultly trying to get the slicers to default to the Dropdown Mode instead of the List Mode.image.pngI have attached a snipt of my code below:

{
"name": "Custom Theme",
	 "dataColors": [
				"#09264E", 
        		"#004AB5",
        		"#FFA300", 
        		"#f2ebdb", 
        		"#D64550",
        		"#197278", 
        		"#1AAB40",
				"#3BB44A",
        		"#F2C811", 
        		"#D63817"
	],

	"visualStyles": {
		"slicer": {
              "*": {
                "responsive":true,
                "selection": [
                  {
                    "singleSelect": false,
                    "selectAllCheckboxEnabled": false
                  }
                ],
                "data": [{
					"mode": "Dropdown"
						}],	
				
				"header": [
                  {
                    "show": false
                  }
                ],
				"title": [
					{
						"show": true,
						"fontColor": { "solid": { "color": "#333333" } },
						"background": { "transparency": { "color": "" } },
						"alignment": "left",
						"fontSize": 10,
						"fontFamily": "Segoe UI Black"
					}
				],
				"items": [{
					"fontColor": { "solid": { "color": "#605E5C"}},
					"background": { "solid": { "color": "#FFFFFF"}},
					"outline": "None",
					"textSize": 9,
					"fontFamily": "Segoe UI"
					}],
				
				"visualHeader": [{
                    "show": false}]
              }
        }
	}
}

 Thank you in advance,

 

Chantelle

6 REPLIES 6
denpries
Resolver I
Resolver I

The issue still exists.

 

denpries_0-1686688448633.png

. In general, we always use drop-down slicers so it would make sense for us to set this up in the JSON by default. As a good boy developer, I initialized the JSON in Visual Studio Code and made sure to use the latest $schema. Reading the documentation, I found that I just need to set the data.mode to "Dropdown" and all should be fine. In the screenshot is a bare minimum snippet of code that should just make the slicer a dropdown by default.

 

However, loading this JSON theme into Power BI changed nothing in the default behavior: The slicer was still showing the data as a list. After studying my code, getting a coffee, staring at my screen some more, and searching the internet again, I finally came to the the post of @AllisonKennedy that said: it actually works, but you need to do something before you can see it.

 

After applying the theme and adding a slicer to your report, look carefully at the settings pane: The 'Reset to default' link is activated! Now for thebig magic trick!: Click it!

Behold! The slicer suddenly decides that actually the JSON told it to be a dropdown, so it should probably transform.

 

So definately a bug in may 2023 version of Power BI still

 

spham1215
Frequent Visitor

I'd like to bump this thread now that the December release has placed the dropdown option into the visualizations pane. Is there a way to identify the JSON label that will allow us to set the Dropdown option in our JSON Theme files?

In my experience, the code provided by @bayeshelsinki works, but only after you click 'reset to default' in the formatting pane.

AllisonKennedy_0-1674457536589.png

 

 

So still a bit of a bug...


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

bayeshelsinki
Regular Visitor

Hi,

 

I'm experiencing the same problem. I have the following json, but the default slicer does not change to dropdown. It is in list / basic mode. According to this documentation, the mode should be changeable to "Dropdown".

 

 

{
"name": "Custom Theme",
	"visualStyles": {
		"slicer": {
              "*": {
                "data": [{
					"mode": "Dropdown"
						}]
              }
        }
    }
}

 

gerardw
New Member

Hi Chantelle

Did you ever resolve this? All the references I have found to date says to set the "data" cardName property  to "mode" : "Dropdown", exactly like you did below, but for whatever reason, I cannot get any of the valid "mode" options to actually work from the template.

Thanks in advance for your reply.

v-joesh-msft
Solution Sage
Solution Sage

Hi @Anonymous ,

I think this may not be possible, the JSON file can only change the parameters of the features that exist in the Format. If you want the initial mode of the slicer to be Dropdown, you can try using the custom slicer, like Smart Filter by OKViz, etc.

61.PNG

Best Regards,

Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.