Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
mridgley
New Contributor

Referencing Expression in SET ANALYSIS

 

I am trying to reference an Expression within SET ANALYSIS, but I am having some difficulties.

 

I have an expressions as follows:

SET IRRAdverseCase =

IF(Region = 'Canada Region',
'Scenario I',
IF(Region = 'US Region',
'Scenario I',
'Scenario II')) ;

I then have an equation, which references the previous expression:

 

SUM(
{<
Scenario = {'$(IRRAdverseCase)'}
>}
[ParCr])

 

When I try to evaluate the expression, it comes up as zero (0). However, if I hard code the Scenario as follows, it produces the correct result:

 

SUM(
{<
Scenario = {'Scenario I'}
>}
[ParCr])

 

I am wondering if anyone knows why this is happening. I would appreciate some help with referencing the Scenario, as opposed to hard coding it because it could change.

 

1 Solution

Accepted Solutions

Re: Referencing Expression in SET ANALYSIS

May be try this

=SUM(

{<

Scenario = {'$(=$(IRRAdverseCase))'}

>}

[ParCr])

When US Region or Canada Region is selected

Capture.PNG

When Asia Region is selected

Capture.PNG

17 Replies

Re: Referencing Expression in SET ANALYSIS

What if you try like this (Without single quotes around your variable)

SUM(
{<
Scenario = {$(IRRAdverseCase)}
>}
[ParCr])

Sergey_Shuklin
Valued Contributor

Re: Referencing Expression in SET ANALYSIS

Hello, Michael!

Try

SUM(
{<
Scenario = {"$(IRRAdverseCase)"}
>}
[ParCr])

Re: Referencing Expression in SET ANALYSIS

You already define variable in Single Quote, So you don't require Single Quote over Set analysis for that variable

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
mridgley
New Contributor

Re: Referencing Expression in SET ANALYSIS

Hi, thanks for the response, but I had tried changing the quotes to "", but it still came up as zero (0)

mridgley
New Contributor

Re: Referencing Expression in SET ANALYSIS

Unfortunately I tried this approach, and it the output of the expression was still zero (0). So single quotes, double quotes and no quotes all produce zero (0).

Re: Referencing Expression in SET ANALYSIS

Actually it worked for me with the single quotes

Capture.PNG

mridgley
New Contributor

Re: Referencing Expression in SET ANALYSIS

Well, actually my expression for 'IRRAdverseCase' is actually a series of equations, so it is not just hard-coded -- guessing that might be what is causing the issue.

Re: Referencing Expression in SET ANALYSIS

Then why don't you post the "real" expression for IRRAdverseCase. Maybe we can still help you figuring out how to get this into shape?

Re: Referencing Expression in SET ANALYSIS

What do you see in variable overview after the script runs through?