3 Replies Latest reply: Dec 19, 2012 11:20 AM by Marc Algera RSS

    Set analysis question/problem

      Hi there,


      I have a Set Analysis question/problem that I'm trying to solve.


      In my chart I have the following calculation :


      SUM({<DateWeek={$(=MAX(Week(QuestionaireDate))-1)} Aantal)


      This works fine in my chart where it shows me the total number for the previous week based on the selected week. I would like to make this a variable so in my script I have put the following statement after the SET.


      SUM({<DateWeek={$(=MAX(Week(QuestionaireDate))-1)} >} Aantal)


      But when I select the variable in de Expression Editor it gives me the following formula:


      SUM({<DateWeek={}>} Aantal)


      So the formula gets lost so probably calculation is wrong. My question is how to get this in the script in a variable.


      I tried several things like


      SUM({<DateWeek={ ' $(=MAX(Week(QuestionaireDate))-1) ' } >} Aantal) But this gives me


      SUM({<DateWeek={''}>} Aantal)


      And even tried this one


      SUM({<DateWeek={ " $(=MAX(Week(QuestionaireDate))-1) " } >} Aantal) But this gives me


      SUM({<DateWeek={""}>} Aantal)


      The last thing I tried was this one


      Create a variable called vPreviousWeek with expression SET vPreviousWeek = $(MAX(Week(QuestionaireDate))-1) and then the expression for another variable


      SUM({<DateWeek={$(vPreviousWeek)} >} Aantal) But this gives me


      SUM({<DateWeek={} Aantal)


      Can someone please help me out? I love the possibilities of Set Analysis but it would be nice if it is possible to use the above one. Simply set I want to put my Set Analysis expression in a variable where in the expression a Max week is calculated based upon the selected week in de QV application. Should not be so difficult I thought but it seems rather extremely difficult to get it working outside of a chart.