Forum Discussion
cjcj
Helper I
3 years agoSwitch with multiple conditions from 2 tables
Hi, is there a way to set swich with mutiple conditions from 2 tables? follwowing works fine for 1 condition from 1 table. TEST = sumx( 'table1', Switch ( True(), 'tab...
- 3 years ago
Hi cjcj ,
If you can't use the RELATED function, you can modify the formula like this:
TEST = VAR _T = ADDCOLUMNS ( 'table1', "temp", MAXX ( FILTER ( 'table2', 'table2'[ID] = EARLIER ( table1[ID] ) ), 'table2'[temp] ) ) RETURN SUMX ( _T, SWITCH ( TRUE (), [color] = "RED" && [temp] = "WARM", 2345, [color] = "BLUE" && [temp] = "HOT", 1345 ) )It can also get the correct result.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yanjiang-msft
Community Support
3 years agoHi cjcj ,
If you can't use the RELATED function, you can modify the formula like this:
TEST =
VAR _T =
ADDCOLUMNS (
'table1',
"temp",
MAXX (
FILTER ( 'table2', 'table2'[ID] = EARLIER ( table1[ID] ) ),
'table2'[temp]
)
)
RETURN
SUMX (
_T,
SWITCH (
TRUE (),
[color] = "RED"
&& [temp] = "WARM", 2345,
[color] = "BLUE"
&& [temp] = "HOT", 1345
)
)
It can also get the correct result.
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.
cjcj
Helper I
3 years agov-yanjiang-msft that worked great! thank you