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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
fred65
Helper I
Helper I

Old Custom Theme JSON File Errors

Hi All,

 

I am getting errors (over 140) loading a custom theme file. My Current version of PBI Desktop is Dec 2023.

It seems that much has changed over the years and all errors are related to visuals. I have managed to fix a bunch but not sure what to do with others.

 

Is there a reference page that gives me details of the changes? I am unable to find anything on the internet.
One example is with PieChart:

#/visualStyles/pieChart/*/labels/0/background must be string (type; matching schema #/properties/visualStyles/properties/pieChart/properties/*/allOf/1/properties/labels/items/properties/background/type)
#/visualStyles/pieChart/*/labels/0/background must be equal to constant (const; matching schema #/properties/visualStyles/properties/pieChart/properties/*/allOf/1/properties/labels/items/properties/background/oneOf/0/const)
#/visualStyles/pieChart/*/labels/0/background must be equal to constant (const; matching schema #/properties/visualStyles/properties/pieChart/properties/*/allOf/1/properties/labels/items/properties/background/oneOf/1/const)
#/visualStyles/pieChart/*/labels/0/background must be equal to constant (const; matching schema #/properties/visualStyles/properties/pieChart/properties/*/allOf/1/properties/labels/items/properties/background/oneOf/2/const)
#/visualStyles/pieChart/*/labels/0/background must match exactly one schema in oneOf (oneOf; matching schema #/properties/visualStyles/properties/pieChart/properties/*/allOf/1/properties/labels/items/properties/background/oneOf)

Here is the code that used to work:

 "pieChart": {
            "*": {
                "labels": [
                    {
                        "show": true,
                        "labelStyle": "Category",
                        "fontSize": 11,
                        "fontFamily": "Segoe UI Bold, wf_segoe-ui_bold, helvetica, arial, sans-serif",
                        "position": "preferOutside",
                        "overflow": false,
                        "background": {
                            "show": false
                        }
                    }
                ]
            }
        }

 

Any assistance appreciated!

Cheers

2 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

Hi @fred65 - Use a JSON schema validator with the official Power BI theme schema link shared below.as per my observation your current error that the background property under labels for pieChart is no longer just a boolean or a simple string value but may require a specific type or constant value.Try adjusting properties like background, position, etc., to see what combination works. If a property is causing issues, sometimes it's best to remove it and test the theme without it.

theme (jsonformatter.org)

 

rajendraongole1_0-1725254668717.png

 

Use report themes in Power BI Desktop - Power BI | Microsoft Learn

 

Hope this helps you to fix the custom theme issue. 

 

 

 





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

Proud to be a Super User!





View solution in original post

v-zhouwen-msft
Community Support
Community Support

Hi rajendraongole1 ,thanks for the quick reply, I'll add more.

Hi @fred65 ,

Regarding your question, first you need to download the software, using Notepad to encode is a disaster.

vzhouwenmsft_0-1725345927043.png

Download the latest file and save it in the same folder as your JSON file.

powerbi-desktop-samples/Report Theme JSON Schema at main · microsoft/powerbi-desktop-samples · GitHu...

vzhouwenmsft_1-1725346068264.png

vzhouwenmsft_2-1725346157253.png

vzhouwenmsft_3-1725346186441.png

Add this line of code in your Json file, then save and restart 'vs code'

"$schema": "reportThemeSchema-2.132.json",

vzhouwenmsft_4-1725346407723.png

Then write the code and there will be a prompt.

vzhouwenmsft_5-1725346482290.png

vzhouwenmsft_6-1725346574467.png

{
	"name": "PieChartTemplate",
	"$schema": "reportThemeSchema-2.132.json",
	"visualStyles": {
		"pieChart": {
			"*": {
				"labels": [{
					"show": true,
					"labelStyle": "Category",
					"fontSize": 20,
					"fontFamily": "Segoe UI Bold, wf_segoe-ui_bold, helvetica, arial, sans-serif",
					"position": "preferOutside",
					"overflow": false,
					"background": "off"
				}]
			}
		}
	}
}

vzhouwenmsft_7-1725346640316.png

GitHub - MattRudy/PowerBI-ThemeTemplates: JSON Templates for assembling Power BI Themes

The template here is a little newer, but it seems to have some problems and needs to be modified according to the error message in Power BI.

 

Best Regards,
Wenbin Zhou

 

View solution in original post

2 REPLIES 2
v-zhouwen-msft
Community Support
Community Support

Hi rajendraongole1 ,thanks for the quick reply, I'll add more.

Hi @fred65 ,

Regarding your question, first you need to download the software, using Notepad to encode is a disaster.

vzhouwenmsft_0-1725345927043.png

Download the latest file and save it in the same folder as your JSON file.

powerbi-desktop-samples/Report Theme JSON Schema at main · microsoft/powerbi-desktop-samples · GitHu...

vzhouwenmsft_1-1725346068264.png

vzhouwenmsft_2-1725346157253.png

vzhouwenmsft_3-1725346186441.png

Add this line of code in your Json file, then save and restart 'vs code'

"$schema": "reportThemeSchema-2.132.json",

vzhouwenmsft_4-1725346407723.png

Then write the code and there will be a prompt.

vzhouwenmsft_5-1725346482290.png

vzhouwenmsft_6-1725346574467.png

{
	"name": "PieChartTemplate",
	"$schema": "reportThemeSchema-2.132.json",
	"visualStyles": {
		"pieChart": {
			"*": {
				"labels": [{
					"show": true,
					"labelStyle": "Category",
					"fontSize": 20,
					"fontFamily": "Segoe UI Bold, wf_segoe-ui_bold, helvetica, arial, sans-serif",
					"position": "preferOutside",
					"overflow": false,
					"background": "off"
				}]
			}
		}
	}
}

vzhouwenmsft_7-1725346640316.png

GitHub - MattRudy/PowerBI-ThemeTemplates: JSON Templates for assembling Power BI Themes

The template here is a little newer, but it seems to have some problems and needs to be modified according to the error message in Power BI.

 

Best Regards,
Wenbin Zhou

 

rajendraongole1
Super User
Super User

Hi @fred65 - Use a JSON schema validator with the official Power BI theme schema link shared below.as per my observation your current error that the background property under labels for pieChart is no longer just a boolean or a simple string value but may require a specific type or constant value.Try adjusting properties like background, position, etc., to see what combination works. If a property is causing issues, sometimes it's best to remove it and test the theme without it.

theme (jsonformatter.org)

 

rajendraongole1_0-1725254668717.png

 

Use report themes in Power BI Desktop - Power BI | Microsoft Learn

 

Hope this helps you to fix the custom theme issue. 

 

 

 





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

Proud to be a Super User!





Helpful resources

Announcements
September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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