Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

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.

Greetings,

Marc

1 Solution

Accepted Solutions

Re: Set analysis question/problem

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)';


talk is cheap, supply exceeds demand
3 Replies

Re: Set analysis question/problem

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)';


talk is cheap, supply exceeds demand
Not applicable

Re: Set analysis question/problem

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

Not applicable

Re: Set analysis question/problem

Gysbert,

it works. By removing the " in the formula it worked. Thanks for the answer!!! It realy helped me out here.

Greetz,

Marc

Community Browser