Forum Discussion
cheezy
6 years agoHelper I
Conditional formatting based on two values/fields in separate tables
trying to work out how i can achieve this and apply a conditional format (new to DAX): for example two tables: table 1 table 2 Field 1 Field 1 ...
- 6 years ago
Hi cheezy ,
If the two tables only have one column, maybe you can create a measure like this:
Measure = var _t1 = SELECTEDVALUE(Table1[Field1]) var _t2 = SELECTEDVALUE(Table2[Field1]) return IF( ( _t1 = "A" && _t2 <=10 ) || ( _t1 = "B" && _t2 <=15 ) || ( _t1 = "C" && _t2 <=20 ), "Value1", IF( ( _t1 = "A" && ( _t2 >10 || _t2 < 20 ) ) || ( _t1 = "B" && ( _t2 >15 && _t2 < 30 ) ) || ( _t1 = "C" && ( _t2 >20 && _t2 < 40 ) ), "Value2", "Value3" ) )Best Regards,
Yingjie LiIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
v-yingjl
6 years agoCommunity Support
Hi cheezy ,
If the two tables only have one column, maybe you can create a measure like this:
Measure =
var _t1 = SELECTEDVALUE(Table1[Field1])
var _t2 = SELECTEDVALUE(Table2[Field1])
return
IF(
( _t1 = "A" && _t2 <=10 ) ||
( _t1 = "B" && _t2 <=15 ) ||
( _t1 = "C" && _t2 <=20 ),
"Value1",
IF(
( _t1 = "A" && ( _t2 >10 || _t2 < 20 ) ) ||
( _t1 = "B" && ( _t2 >15 && _t2 < 30 ) ) ||
( _t1 = "C" && ( _t2 >20 && _t2 < 40 ) ),
"Value2",
"Value3"
)
)
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
cheezy
6 years agoHelper I
many thanks Yingjie , your solutions works a treat.