Forum Discussion
Multiple condition in if
- 8 years ago
Hello, Switch should be perfect.
I assume two measures,
CA1 for ca in date1 and CA2 for ca in date2.
Switch(
TRUE(),
[CA1]=0 && [CA2]<>0, 'new', --condition 1
[CA1]>[CA2], 'up', --condition 2
[CA1]<[CA2], 'down' --condition 3
[CA1]<>0 && [CA2]=0, 'unknown' --condition 4
BLANK()) --elseFor further information check this article.
I hope this helps. I want miss the SWITCH function anymore.
mntper1 and mntper2 are amount so they are number but seg client is a switch function that i create in a measure by your help
seg_client = Switch( TRUE(); [MntPer1] = 0 && [MntPer2]<>0; "new"; --condition 1
[MntPer1]<[MntPer2]; "up"; --condition 2
[MntPer1]>[MntPer2]; "down" ; --condition 3
[MntPer1]<>0 && [MntPer2]=0; "unknown" ; --condition 4
BLANK()) --else
and it's a text according to power bi
Did you erse the '--condition x' ? They were just for information and not meant to be part of the formula.
Calculated column should be:
= Switch( TRUE(); [MntPer1] = 0 && [MntPer2]<>0; "new";
[MntPer1]<[MntPer2]; "up";
[MntPer1]>[MntPer2]; "down" ;
[MntPer1]<>0 && [MntPer2]=0; "unknown" ;
BLANK())
- Anonymous8 years agoNot applicable
yes i khnow it's just a comment "-- condition" it doesn't affect the formula