Forum Discussion
Anonymous
3 years agoNot applicable
Color formatting with 3 conditions
Hello,
I need to apply the formatting background of column 2 in Table visual with 3 different conditions :
| Column 1 | Column 2 | Column 3 | Column 4 |
| 4 | 2 | 3 | 8 |
| 5 | 7 | 4 | 2 |
| 4 | 4 | 2 | 2 |
Condition 1 : Column 2 = Column 1 : no color
Condition 2 : Column 2 > Column 1 : Red
Condition : Column 3 > Column 4 : Orange
Thank you in advance.
#Measures :
_BGColor1 =VAR col1 = SELECTEDVALUE('conditional Formatting'[Column1])VAR col2 = SELECTEDVALUE('conditional Formatting'[Column2])VAR col3 = SELECTEDVALUE('conditional Formatting'[Column3])VAR col4 = SELECTEDVALUE('conditional Formatting'[Column4])RETURNIF(col2=col1,"#0000FF","Yellow")#Measure_2 :_BGColor2 =VAR col1 = SELECTEDVALUE('conditional Formatting'[Column1])VAR col2 = SELECTEDVALUE('conditional Formatting'[Column2])VAR col3 = SELECTEDVALUE('conditional Formatting'[Column3])VAR col4 = SELECTEDVALUE('conditional Formatting'[Column4])RETURNIF(col2>col1,"RED","Yellow")#Measure_3 :_BGColor3 =VAR col1 = SELECTEDVALUE('conditional Formatting'[Column1])VAR col2 = SELECTEDVALUE('conditional Formatting'[Column2])VAR col3 = SELECTEDVALUE('conditional Formatting'[Column3])VAR col4 = SELECTEDVALUE('conditional Formatting'[Column4])RETURNIF(col3>col4,"Orange","Yellow")#Measure_4 :_BGColor4 =VAR col1 = SELECTEDVALUE('conditional Formatting'[Column1])VAR col2 = SELECTEDVALUE('conditional Formatting'[Column2])VAR col3 = SELECTEDVALUE('conditional Formatting'[Column3])VAR col4 = SELECTEDVALUE('conditional Formatting'[Column4])RETURNIF(col2>col1,"#00FFFF","Yellow")If this post helps, please consider accept as solution to help other members find it more quickly.
2 Replies
- Mahesh0016
Super User
#Measures :
_BGColor1 =VAR col1 = SELECTEDVALUE('conditional Formatting'[Column1])VAR col2 = SELECTEDVALUE('conditional Formatting'[Column2])VAR col3 = SELECTEDVALUE('conditional Formatting'[Column3])VAR col4 = SELECTEDVALUE('conditional Formatting'[Column4])RETURNIF(col2=col1,"#0000FF","Yellow")#Measure_2 :_BGColor2 =VAR col1 = SELECTEDVALUE('conditional Formatting'[Column1])VAR col2 = SELECTEDVALUE('conditional Formatting'[Column2])VAR col3 = SELECTEDVALUE('conditional Formatting'[Column3])VAR col4 = SELECTEDVALUE('conditional Formatting'[Column4])RETURNIF(col2>col1,"RED","Yellow")#Measure_3 :_BGColor3 =VAR col1 = SELECTEDVALUE('conditional Formatting'[Column1])VAR col2 = SELECTEDVALUE('conditional Formatting'[Column2])VAR col3 = SELECTEDVALUE('conditional Formatting'[Column3])VAR col4 = SELECTEDVALUE('conditional Formatting'[Column4])RETURNIF(col3>col4,"Orange","Yellow")#Measure_4 :_BGColor4 =VAR col1 = SELECTEDVALUE('conditional Formatting'[Column1])VAR col2 = SELECTEDVALUE('conditional Formatting'[Column2])VAR col3 = SELECTEDVALUE('conditional Formatting'[Column3])VAR col4 = SELECTEDVALUE('conditional Formatting'[Column4])RETURNIF(col2>col1,"#00FFFF","Yellow")If this post helps, please consider accept as solution to help other members find it more quickly. - Mahesh0016
Super User
can you share sample output in table format?