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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
BIuser09
Regular Visitor

Pre Selected Slicer formatting with Json

hi,

 

I'm using a Json file for defining used font in my PBI report.

Works fine, however, I had to import a 'Pre Selected Slicer' visual and my font is not applied on that visual.

Someone can help ?

Find below content of my uploaded Json file. Tried to include the pre selected slicer but does not work:

 

{"name":"Custom",
"textClasses":{
"title":{"fontFace":"Montserrat,Century Gothic"},
"label":{"fontFace":"Montserrat,Century Gothic"},
"callout":{"fontFace":"Montserrat,Century Gothic"},
"header":{"fontFace":"Montserrat,Century Gothic"},
"largeTitle":{"fontFace":"Montserrat,Century Gothic"},
"dataTitle":{"fontFace":"Montserrat,Century Gothic"},
"boldLabel":{"fontFace":"Montserrat,Century Gothic"},
"smallLabel":{"fontFace":"Montserrat,Century Gothic"},
"largeLabel":{"fontFace":"Montserrat,Century Gothic"},
"largeLightLabel":{"fontFace":"Montserrat,Century Gothic"},
"lightLabel":{"fontFace":"Montserrat,Century Gothic"},
"semiboldLabel":{"fontFace":"Montserrat,Century Gothic"},
"smallLightLabel":{"fontFace":"Montserrat,Century Gothic"},
"smallDataLabel":{"fontFace":"Montserrat,Century Gothic"}
},
"visualStyles":{
"Pre Selected Slicer":{
  "*":{
"Header":[{
"Font family":"Montserrat,Century Gothic"
}],
"Items style":[{
"Font family":"Montserrat,Century Gothic"
}]
 
      }
  }
}
}

 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @BIuser09 

After a bit of testing, it appears that you need to:

  • Change "Pre Selected Slicer" to "PreselectedSlicer9302176388541" (the visual's guid)
  • Change "Header" and "Items Style" to "header" and "items" 

I concluded this after downloading the pbiviz file from the AppSource page here.

I then extracted the files from the pbiviz file (it is effectively a zip file) and examined the file PreselectedSlicer9302176388541.pbiviz.json.

 

It was a bit of trial and error, but it appeared to work as expected when I tested in Power BI Desktop.

 

So the theme should end up as:

 

 

{
	"name": "Custom",
	"textClasses": {
		"title": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"label": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"callout": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"header": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"largeTitle": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"dataTitle": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"boldLabel": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"smallLabel": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"largeLabel": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"largeLightLabel": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"lightLabel": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"semiboldLabel": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"smallLightLabel": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"smallDataLabel": {
			"fontFace": "Montserrat,Century Gothic"
		}
	},
	"visualStyles": {
		"PreselectedSlicer9302176388541": {
			"*": {
				"header": [
					{
						"fontFamily": "Montserrat,Century Gothic"
					}
				],
				"items": [
					{
						"fontFamily": "Montserrat,Century Gothic"
					}
				]
			}
		}
	}
}

 

 

I did find some sources stating that multi-word font names should be enclosed in single quotes, but this didn't seem to matter.

 

Does this work for you?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

3 REPLIES 3
BIuser09
Regular Visitor

Thanks Auger !

 

It was indeed a kind of trial and error.

Did not work in my report at first try. (read tries)

However I was able to do it in a sample file.

Finally deleted my 2 slicers and added back as new, uploaded Json file and it worked!

 

Tip: to get the official visual name to use in Json:

right click on visual in build screen and select 'About'

 

BIuser09_0-1738924912533.png        

BIuser09_1-1738924982291.png

 

 

You're welcome.
Nice work, and thanks for posting that additional detail! I hadn't thought of checking the visual's context menu so that's very useful to know 🙂


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn
OwenAuger
Super User
Super User

Hi @BIuser09 

After a bit of testing, it appears that you need to:

  • Change "Pre Selected Slicer" to "PreselectedSlicer9302176388541" (the visual's guid)
  • Change "Header" and "Items Style" to "header" and "items" 

I concluded this after downloading the pbiviz file from the AppSource page here.

I then extracted the files from the pbiviz file (it is effectively a zip file) and examined the file PreselectedSlicer9302176388541.pbiviz.json.

 

It was a bit of trial and error, but it appeared to work as expected when I tested in Power BI Desktop.

 

So the theme should end up as:

 

 

{
	"name": "Custom",
	"textClasses": {
		"title": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"label": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"callout": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"header": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"largeTitle": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"dataTitle": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"boldLabel": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"smallLabel": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"largeLabel": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"largeLightLabel": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"lightLabel": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"semiboldLabel": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"smallLightLabel": {
			"fontFace": "Montserrat,Century Gothic"
		},
		"smallDataLabel": {
			"fontFace": "Montserrat,Century Gothic"
		}
	},
	"visualStyles": {
		"PreselectedSlicer9302176388541": {
			"*": {
				"header": [
					{
						"fontFamily": "Montserrat,Century Gothic"
					}
				],
				"items": [
					{
						"fontFamily": "Montserrat,Century Gothic"
					}
				]
			}
		}
	}
}

 

 

I did find some sources stating that multi-word font names should be enclosed in single quotes, but this didn't seem to matter.

 

Does this work for you?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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