Forum Discussion

Snowy34's avatar
Snowy34
Icon for Helper III rankHelper III
7 years ago
Solved

Measure with an if statment??

Good morning all,

 

I'm bit new to this and I was hoping someone could give me some help with the below issue I have.

 

I got a simple measure and this works fine but I need to add an IF statement to it, what I need it to do is the following,

 

IF the answer to the below measure is more then [Prime Shelf] value report 0 and if its less report that value. Could someone please show me how to do this.

 

Free Prime Shelfs =
[Prime Shelf] - [Used Prime Shelf]
 
Regards 
  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi Snowy34 

     

     
    Free Prime Shelfs =
    VAR _ANSWER = [Prime Shelf] - [Used Prime Shelf]
    RETURN
    IF(_ANSWER > [Prime Shelf], 0, _ANSWER)

    Cheers!
    A

     

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Snowy34 

     

     
    Free Prime Shelfs =
    VAR _ANSWER = [Prime Shelf] - [Used Prime Shelf]
    RETURN
    IF(_ANSWER > [Prime Shelf], 0, _ANSWER)

    Cheers!
    A

     
    • Snowy34's avatar
      Snowy34
      Icon for Helper III rankHelper III

      Hi mate,

       

      Just tried that and it just returned the same number as before. In this case, the return value should have been 0

       

       

       

      Still showing as -108

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Snowy34 

        Give more info.

        It is hard to determine whats wrong according to pieces of information.
        But, according to the screenshot below, 'used prome shelf' is 470?
        So the calculation is correct. Myabe I got the '>' sign wrong? try using '<' insteaad.

         

        Cheers!
        A