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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BSM1985
Helper IV
Helper IV

Decomposition Conditional Formatting

Hi Team,
I have decomposition tree with 3 levels as shown below.
Requirement: In this hierarchy, I would need:
1. All 'Yes' nodes in Blue color
2. Level A node 'No' should be in Black
3. Level B node 'No' should be in Amber
4. Level C node 'No' should be in Grey

 

Sample pwbix file

https://1drv.ms/u/s!ArRkjWtfVLy-blFLsv39onMwWrQ

 

CF.png

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @BSM1985 ,

 

Try to add the following custom measure:

 

Measure = SWITCH(
                   TRUE();
                   SELECTEDVALUE(Testing[A]) = "NO";"Black";
                   SELECTEDVALUE(Testing[B]) = "NO";"#FFC200";
                   SELECTEDVALUE(Testing[C]) = "NO";"Grey"
                 )

 

 

You can also change the Black and Grey to other custom colour codes just remember to place the # before the code.

MFelix_0-1600690304608.png

 

Check PBIX file attach. 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

10 REPLIES 10
eli9879
Regular Visitor

@MFelix 

I would like to display on my decomposition tree the "Names" columns with the colors in the "Color" columns respectively.
How can I do that?
I tried with a measure like Switch(True(),Selectvalue(Name1),color) but it doesn't work for me.

 

eli9879_0-1678714666186.png

eli9879_1-1678714689839.png

 

Hi @eli9879 ,

 

Not sure if I understand what you mean by "Names" columns with the colors in the "Color" columns respectively.

 

Try to create the following measure:

Color Coding = SWITCH(TRUE(),
                    ISINSCOPE('Table'[Name3]), SELECTEDVALUE('Table'[Color3]),
                    ISINSCOPE('Table'[Name2]), SELECTEDVALUE('Table'[Color2]),
                    ISINSCOPE('Table'[Name1]), SELECTEDVALUE('Table'[Color1]))

Be carefull with the order of the columns since the switch function stops at the first result:

MFelix_0-1678751105077.pngMFelix_1-1678751117858.png

See file attach.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Amazing!! very helpful.

Thanks

Anonymous
Not applicable

Hi @MFelix

Can you please share how the color of the parent data bars can also be changed as per a condition? 

MFelix
Super User
Super User

Hi @BSM1985 ,

 

Try to add the following custom measure:

 

Measure = SWITCH(
                   TRUE();
                   SELECTEDVALUE(Testing[A]) = "NO";"Black";
                   SELECTEDVALUE(Testing[B]) = "NO";"#FFC200";
                   SELECTEDVALUE(Testing[C]) = "NO";"Grey"
                 )

 

 

You can also change the Black and Grey to other custom colour codes just remember to place the # before the code.

MFelix_0-1600690304608.png

 

Check PBIX file attach. 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Sorry @MFelix 

I was not clear. This works for one node, not for all as shown below. I would need different color for each 'No' for each node as shown in below screenshot.CF2.png

Hi @BSM1985 ,

 

Believe that has to do with the order of the function try:

Measure =
SWITCH (
    TRUE ();
    SELECTEDVALUE ( Testing[C] ) = "NO"; "Grey";
    SELECTEDVALUE ( Testing[C] ) = "Yes"; "Blue";
    SELECTEDVALUE ( Testing[B] ) = "NO"; "#FFC200";
    SELECTEDVALUE ( Testing[B] ) = "Yes"; "Blue";
    SELECTEDVALUE ( Testing[A] ) = "No"; "Black";
    SELECTEDVALUE ( Testing[A] ) = "Yes"; "Blue"
)

Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix Please take a look on this

    In Decomposition tree condition formation i need to change color based on 1 column value .

    If it is fail then its parent also should be in red....

    You can see the measure i had used in below image ..

Ayappan_0-1649523556878.png

 

Thanks in advance ..

 

Hi @Ayappan 

 

Can you please share some more details? If you can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks a lot @MFelix 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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