Forum Discussion
Conditional formatting
- 4 years ago
Hi,
You can create a measure like this :
Colors of Tasks = SWITCH( TRUE(),SELECTEDVALUE( TaskList[Actual] ) = SELECTEDVALUE( TaskList[Planned] ) && SELECTEDVALUE( TaskList[Actual] )=1 , "#0000CD", //blueSELECTEDVALUE( TaskList[Actual] ) = SELECTEDVALUE( TaskList[Planned] ) && SELECTEDVALUE( TaskList[Actual] )<1 , "#98FB98", //greenSELECTEDVALUE( TaskList[Actual] ) > SELECTEDVALUE( TaskList[Planned] ) , "#7FFF00", //green otherSELECTEDVALUE( TaskList[Actual] ) < SELECTEDVALUE( TaskList[Planned] ) , "#FF0000", //redISBLANK( SELECTEDVALUE( TaskList[Actual] ) ) && ISBLANK( SELECTEDVALUE( TaskList[Planned] ) ) , "#D3D3D3", //grey"#FFFFFF" //else white)and then use it in Conditionnal formatting using (values of fields) :Hope it make sense for you otherwise do not hesitate to ask for more details.Have a nice day - 4 years ago
QAA91 , You can create a measure like
Assuming they are % column
color
Switch( True() ,
[Planned] =1 && [Actual] =1, "Blue" ,
([Planned] =[Actutal] && [Actual] <> 1) || [Planned] < [Actutal] , "Green" ,
[Planned] > [Actutal] , "Red",
"Grey"
)
Use this in conditional formating using the field value option.
A blank value will not take any color
PowerBI Abstract Thesis: How to do conditional formatting by measure and apply it on pie? : https://youtu.be/RqBb5eBf_I4
- 4 years ago
Hi, Sorry one mistake in my formula, you should do the test for blank at first otherwise when both are blanks you'll get green because both have same value ;-=
So the formula should be :
Colors of Tasks = SWITCH( TRUE(),ISBLANK( SELECTEDVALUE( TaskList[Actual] ) ) && ISBLANK( SELECTEDVALUE( TaskList[Planned] ) ) , "#D3D3D3", //greySELECTEDVALUE( TaskList[Actual] ) = SELECTEDVALUE( TaskList[Planned] ) && SELECTEDVALUE( TaskList[Actual] )=1 , "#0000CD", //blueSELECTEDVALUE( TaskList[Actual] ) = SELECTEDVALUE( TaskList[Planned] ) && SELECTEDVALUE( TaskList[Actual] )<1 , "#98FB98", //greenSELECTEDVALUE( TaskList[Actual] ) > SELECTEDVALUE( TaskList[Planned] ) , "#7FFF00", //green otherSELECTEDVALUE( TaskList[Actual] ) < SELECTEDVALUE( TaskList[Planned] ) , "#FF0000", //red"#FFFFFF" //else white)Do not forget to check as solved if this works as expected
QAA91 , You can create a measure like
Assuming they are % column
color
Switch( True() ,
[Planned] =1 && [Actual] =1, "Blue" ,
([Planned] =[Actutal] && [Actual] <> 1) || [Planned] < [Actutal] , "Green" ,
[Planned] > [Actutal] , "Red",
"Grey"
)
Use this in conditional formating using the field value option.
A blank value will not take any color
PowerBI Abstract Thesis: How to do conditional formatting by measure and apply it on pie? : https://youtu.be/RqBb5eBf_I4
Thank you very much