Forum Discussion
Aucesar
Helper III
3 years agoIF Multiples Statements in DAX
Hi Everyone;
I need help to calculate commision based on production defects as below:
IF production category "A" and is below 1% comission equals FULL, if between 1% and 2% Comission equals HALF, above 25 NONE,
IF production category "B" and is below 1% comission equals FULL, above NONE
IF production category "C" and is below 5% comission equals FULL, above NONE
Category is a column with Text value, % is measure.
Tried some replies but can´t figure out AND´s IF´s I need to use...
You can use a switch too. Something like this:
Commision= SWITCH( SELECTEDVALUE(Table[Category]), "A", IF ([Value] <0.01,"FULL", IF([Value] >=0.01 && [Value] <=0.02,"HALF", IF([Value] >0.25,"NONE"))), "B", IF ([Value] <0.01,"FULL", "NONE"), "C", IF ([Value] <0.05,"FULL","NONE") )
6 Replies
- mlsx4
Memorable Member
You can use a switch too. Something like this:
Commision= SWITCH( SELECTEDVALUE(Table[Category]), "A", IF ([Value] <0.01,"FULL", IF([Value] >=0.01 && [Value] <=0.02,"HALF", IF([Value] >0.25,"NONE"))), "B", IF ([Value] <0.01,"FULL", "NONE"), "C", IF ([Value] <0.05,"FULL","NONE") )- mlsx4
Memorable Member
Hi Aucesar
Have you tried with the following for each?
Numb= var half= CALCULATE(COUNTROWS(TABLE),Commision="HALF") var none= CALCULATE(COUNTROWS(TABLE),Commision="NONE") var full= CALCULATE(COUNTROWS(TABLE),Commision="FULL") RETURN half+none+fullAlso, how have you created the value Commision as a column or as a measure?
If it is a column you can do:
all numb= CALCULATE(COUNTROWS(Table),ALLEXCEPT(Table, Table[Commision] ) )