Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.I 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
The issue still exists.
. 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
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.
So still a bit of a bug...
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
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"
}]
}
}
}
}
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.
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.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
110 | |
91 | |
84 | |
66 |