2 Replies Latest reply: Sep 13, 2012 1:12 AM by lovellj1 RSS

    Variable Within If Statement not working as expected - Please Help!

      Hi all,


      I have created a simple Sum IF expression which includes a variable. I have created the variable within the variable overview within the document, variable works fine, however it fails to work within the expression;


      Variable:    vMaxOrdMon = Max([Month Num Ord])


      The variable returns the number '3' when displayed in a text box: =$(vMaxOrdMon)


      So the variable is working correctly;


      I have then created an expression which uses the variable:


      =Sum(If([Month Num Tar] > 0 AND [Month Num Tar] <= $(vMaxOrdMon),[Target Value], 0))


      This is however returning null? - Very frustrating, cant think for the life of me why!?!


      If you replace the variable with the number '3' the expression works fine and correctly returning the correct value (1765.94).


      =Sum(If([Month Num Tar] > 0 AND [Month Num Tar] <= 3,[Target Value], 0))


      This is returning 1765.94; the correct resulting value;


      Any idea why the variable does not work within the expression?


      Any help greatly appreciated;