Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

If statement using or

Hi,

 

Have the below measure. It returns the number 6 if conditions are met. This is what i want.

 

ScoreM =
VAR conscore = IF([8 Wks Con] = 7 && [8 Wk Avg] > 20,6)
Return
conscore
 
However I need to add multiple if statements. Example is 
 
ScoreM =
VAR conscore = IF([8 Wks Con] = 7 && [8 Wk Avg] > 20,6)
||
IF([8 Wks Con] = 6 && [8 Wk Avg] < 20,1)

Return
conscore
 
What I want from this is if the 1st IF statement is satisifed then return 6 
or
if the 2nd If statement is satisfied return 1.
 
What it is doing instaed is returning True or False.
 
 
  • Anonymous's avatar
    Anonymous
    6 years ago

    Arrh yes. I normally use ';' but then you should just adjust the measure:

     

    scoreM = 
    IF([8 Wks Con] = 7 && [8 Wks Avg] > 20, 6, IF([8 Wks Con] = 6 && [8 Wks Avg] < 20, 1, BLANK()))

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi

     

    How about the following:

    ScoreM =
    VAR conscore = IF([8 Wks Con] = 7 && [8 Wk Avg] > 20,6; 6; IF([8 Wks Con] = 6 && [8 Wk Avg] < 20,1; 1; BLANK())
    
    Return
    conscore

    If it works then please mark it as the accepted solution.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Anonymous  Thks for reply.

       

      Giving me syntax errors. Replace some ; with , maybe?

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Arrh yes. I normally use ';' but then you should just adjust the measure:

         

        scoreM = 
        IF([8 Wks Con] = 7 && [8 Wks Avg] > 20, 6, IF([8 Wks Con] = 6 && [8 Wks Avg] < 20, 1, BLANK()))