Forum Discussion
R_
8 years agoRegular Visitor
Nested If condition
Hi All, How to make nested if condition in Power BI. I have to create condition as : If (Amount is <=1000 and Year is MaxYear) , If(Amount is between <1000 and Year = MaxYe...
MFelix
8 years agoSuper User
Hi R_,
The best way is to use a SWITCH function something like this:
Period =
SWITCH (
TRUE (),
SUM ( Table[Amount] ) <= 1000
&& Date[Year] = MAX ( Date[Year] ), "Period",
SUM ( Table[Amount] ) < 1000
&& Date[Year]
= MAX ( Date[Year] ) - 1, "Period1",
SUM ( Table[Amount] ) < 1000
&& SUM ( Table[Amount] ) > 1000
&& Date[Year] = MAX ( Date[Year] ), "Period2",
...,
"ALL PERIOD"
)Regards,
MFelix
- R_8 years agoRegular Visitor
Hi ,
Period = SWITCH ( TRUE (), SUM ( Table[Amount] ) <= 1000 && Date[Year] = MAX ( Date[Year]), "Period",SUM ( Table[Amount] ) < 1000 && Date[Year] = MAX ( Date[Year] ) - 1, "Period1", SUM ( Table[Amount] ) < 1000 && SUM ( Table[Amount] ) > 1000 && Date[Year] = MAX ( Date[Year] ), "Period2",Hi Plz chk my requirement once again..
If (Amount is <=1000 and Year is MaxYear) ,
If(Amount is between <1000 and Year = MaxYear-1) then "Period1" ,
If(Amount is between <1000 & >2000 and Year = MaxYear-1) then "Period2"...
If (Amount is <=1000 and Year is MaxYear) ::: this is common for period1 & period2..
Thanks,