2 Replies Latest reply: Apr 28, 2015 3:53 PM by gerry castellino RSS

    Need help  on a calc

    gerry castellino

      I have a calc in the UI as follows.

      It looks at a sum(calc) of a specific dimension for specific period,   dividing by sum(calc) all dimension for a specific period:


      num((sum({$<RS={ "$(=only({[Comp2]} RS))"}>} calc1) -

                sum({$<RS={ "$(=only({[Comp1]} RS))"}>} calc1))


      (sum(TOTAL <EDATE> {$<RS={ "$(=only({[Comp2]} RS))"} >} calc1)-

        sum(TOTAL  <EDATE>  {$<RS={ "$(=only({[Comp1]} RS))"} >} calc1)), v_Format_Percent)


      I have now broken this down in variables in a ".qvs" file,  but not getting the desired results.

      My variables in the file are as follows - The numerator and denominator are performing the correct calcs, the division(RESULT) is

      way off:


      LET NUMERATOR = 'sum({$<RS={ "' &chr(36)&'(=only({[Comp1]} RS))" }>} calc1) - sum({$<RS={ "' &chr(36)&'(=only({[Comp2]} RS))" }>} calc1)';


      LET DENOMINATOR  ='sum(TOTAL <EDATE> {$<RS={ "' &chr(36)&'(=only({[Comp2]} RS))"} >} calc1) -

                                              sum(TOTAL <EDATE> {$<RS={ "' &chr(36)&'(=only({[Comp1]} RS))"} >} calc1)';

      LET RESULT= 'num('&chr(36)&'(NUMERATOR) / '&chr(36)&'(DENOMINATOR), v_Format_Percent)';