Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Greetings,
Marc
What's happening is that when setting the variable qlikview tries to evaluate the part of your expression that starts with $. Since that returns nothing you get the result you see. You can try it this way:
LET variable = 'SUM({<DateWeek={" ' & '$' & '(=MAX(Week(QuestionaireDate))-1) " } >} Aantal)';
What's happening is that when setting the variable qlikview tries to evaluate the part of your expression that starts with $. Since that returns nothing you get the result you see. You can try it this way:
LET variable = 'SUM({<DateWeek={" ' & '$' & '(=MAX(Week(QuestionaireDate))-1) " } >} Aantal)';
Hi Gysbert,
thanks for the reply. Unfortunately it still does'nt work. It gives me now
SUM({<DateWeek={"$(=MAX(Week(EnqueteDatum))-1) " } >} Aantal) als value in my chart for every row and it is not calculating the answer.
Oeps, forgot the change SET to LET...I'm almost there. It now gives
SUM({<DateWeek={"49" } >} Aantal)
Greetz,
Marc
Gysbert,
it works. By removing the " in the formula it worked. Thanks for the answer!!! It realy helped me out here.
Greetz,
Marc