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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Aksha_poojari
New Member

powerbi custom theme for stacked bar graph using json file

How we can create the custom theme for stacked bar graph using json file which include the conditional rule. i used the below code to achive the same but it's throwin error as error while importing the json file. Looks like conditional format is not supported here? it should be done manually?

"barChart": {
"*": {
"dataPoint": {
"fill": {
"solid": {
"color": {
"$expr": "d => {
if (d.value <= 20) return '#ED9AA1';
else if (d.value <= 40) return '#E77881';
else if (d.value <= 60) return '#E15662';
else if (d.value <= 80) return '#B4454E';
else return '#87343B';
}"
}
}
}
}
}
}

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @Aksha_poojari - In Power BI does not support conditional formatting directly in the JSON theme file, you can define colors in a JSON file and then apply the conditional formatting rules on the top of it using conditions manually through the Power BI interface. 

 

create a measure calcuation and define the conditional formatting as per your requirement.

 

rajendraongole1_0-1718783971443.png

 

Hope the above information helps you.

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

 





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

Proud to be a Super User!





View solution in original post

2 REPLIES 2
Aksha_poojari
New Member

Thanks for the solution

rajendraongole1
Super User
Super User

Hi @Aksha_poojari - In Power BI does not support conditional formatting directly in the JSON theme file, you can define colors in a JSON file and then apply the conditional formatting rules on the top of it using conditions manually through the Power BI interface. 

 

create a measure calcuation and define the conditional formatting as per your requirement.

 

rajendraongole1_0-1718783971443.png

 

Hope the above information helps you.

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

 





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

Proud to be a Super User!





Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.