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
analyst7112
Regular Visitor

Decomposition Tree Color Coding

Hello,

 

I am using the built-in PowerBI Decomposition Tree visual. My data consists of three fields - A, B, C. Each field is comprised of 'Yes' or 'No'.

 

Within each field, I want 'Yes' to have a green bar and 'No' to have a red bar. The conditional formatting that I'm trying to apply appears to work at first glance. However, after going through potential scenarios, I realized that the formatting isn't correct.

 

Applied correctly:

analyst7112_0-1669930048486.png

     All of the 'Yes' and 'No' have their proper color.

 

Applied incorrectly:

analyst7112_1-1669930106233.png

     The 'No' in B is formatted green.

 

DAX Code:

analyst7112_2-1669930196983.png

     This creates a Measure, which is used in the Conditional Formatting rule.

 

Conditional Formatting:

analyst7112_3-1669930265079.png

 

I have played around with the code and settings a little bit but can't find anything that will work. Am I doing something incorrectly or should I report this as a bug to Microsoft?

 

Thank you!

 

7 REPLIES 7
v-yanjiang-msft
Community Support
Community Support

Hi @analyst7112 ,

After digging, I find the error is occured because if A is "NO" and B is "NO", then all values for C is "YES".

vkalyjmsft_0-1670581015240.png

In this way, the measure will not analyze to the next level "B", all values suit the condition 

SELECTEDVALUE(Testing[C]) = "YES".

vkalyjmsft_1-1670581101958.png

A roughly but effective solution is add a row in the data source, A is "NO" and B is "NO" and C is "NO", but the count column is 0. I create a new sample to test and get the correct result:

vkalyjmsft_3-1670581874343.png

 

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Just following up again - is there any solution that doesn't require listing out all possible permutations? My data has 5 selections in each field, and there is 6 fields. 5^6 = 15625, which is largely impractical to list out for this data.

Is there any other option? I was using simplified data due to privacy concerns. However, instead of 'YES' or 'NO', there are actually 5 options per category. There are 5 categories total, so the number of permutations grows quite fast, and I'm not sure this option is feasible. Is there a better way to assign conditional formatting or a quicker workaround to the solution you described?

vanessafvg
Super User
Super User

have you checked the values you are using?  ie change it to a table or matrix to see what is happening.  You dont have a catch in your switch statement, maybe, for your last statement put in another colour like orange or something maybe your values aren't not present so therefore it just defaults to green.

so after this line add

 

vanessafvg_0-1669932916971.png

 , "Orange")





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Unfortunately, adding a catch did not work. What analysis should I do on the table? This is what I'm seeing:

analyst7112_0-1669933527394.png

 

pleasse share your sample data and code in text





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




https://drive.google.com/file/d/1h0VgiVHX8pNk3Rjb4lw5CiMA4Hv4j1Lk/view?usp=sharing

 

Here is the link to my PowerBI project. This is still the original poster - I had to create another account on here. Thank you for your help.

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!

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.