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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
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.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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