4 Replies Latest reply: May 7, 2011 5:10 AM by Sascha Zevenhuizen RSS

    Problem with set expressions

    Sascha Zevenhuizen

      Dear fellow developers,

       

      In a chart with a date dimension called GenDat, i'm trying to calculate the difference between this period's sales and the previous period's sales. I'm trying to achieve this using set analysis, but I can't get it working.

       

      This expression works:

       

      sum({<GenDat={'$(=AddMonths('1-3-2011',-1))'}>} Total Sales)

       

      The period to which I'm comparing is fixed to 1-3-2011 for debugging purposes, 'Total' is necessary because I need to override the GenDat dimension value. But if I try to replace this fixed period by the variable GenDat, which seems a small step now, it stops working:

       

      sum({<GenDat={'$(=AddMonths(GenDat,-1))'}>} Total Sales)

       

      This expression results in only zero values. The expression AddMonths(GenDat,-1)) works well stand-alone if GenDat is restricted to a single value.

       

      Why won't the second expression lead to the correct results, and how can I achieve what I'm trying to achieve?

       

      Any help would be much appreciated!

       

      Regards,

       

      Sascha.