Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Discussion Board for collaboration related to QlikView App Development.

Announcements

QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: **REGISTER NOW!**

- Qlik Community
- :
- All Forums
- :
- QlikView App Dev
- :
- Set analysis question/problem

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Not applicable

2012-12-19
10:29 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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

376 Views

1 Solution

Accepted Solutions

2012-12-19
10:38 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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

190 Views

3 Replies

2012-12-19
10:38 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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

191 Views

Not applicable

2012-12-19
11:09 AM

Author

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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

190 Views

Not applicable

2012-12-19
11:20 AM

Author

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Gysbert,

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

Greetz,

Marc

190 Views