6 Replies Latest reply: Jan 5, 2012 3:26 PM by Man Ting Liu RSS

    Expression as variable not working in Set Analysis

      Hi all,

       

      I am trying to integrate some variable in a set analysis, but I have difficulty to make it right.  I just wonder if anyone knows how to resolve it?

       

      (The QlikView application was built with a lot of variables, so I have to inherit the same coding standard.)

       

      The set analysis should be evaluated like the following at the end.  This expression works when I put it under the Expression tab on a bar chart.

      sum({$ <MonthYearNum = {">=$(=num(MonthStart(AddMonths(max(EndMonth), -5))))"}>} [Total Pounds])

       

       

      I tried the following but none of them worked:

      SET vBack6MonthYearNum = '=num(MonthStart(AddMonths(max(EndMonth), -5)))';  (this variable will be re-used in many other set analysis)


      SET vTotalPounds6MonBk1 = 'sum({$ <MonthYearNum = {">=$($(vBack6MonthYearNum))"}>} [Total Pounds])';

      ---> In Variable Overview it becomes sum({$ <MonthYearNum = {">=(internal error)"}>} [Total Pounds])

       

      SET vTotalPounds6MonBk2 = 'sum({$ <MonthYearNum = {">=$(=$(vBack6MonthYearNum))"}>} [Total Pounds])';

      --> In Variable Overview it becomes sum({$ <MonthYearNum = {">=(internal error)"}>} [Total Pounds])


      SET vTotalPounds6MonBk3 = 'sum({$ <MonthYearNum = {">=$(=num(MonthStart(AddMonths(max(EndMonth), -5))))"}>} [Total Pounds])';

      --> In Variable Overview it becomes sum({$ <MonthYearNum = {">=(internal error)"}>} [Total Pounds])

       

       

      I appreciate all feedback.  Thanks a lot.