Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
sunny_talwar

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

View solution in original post

17 Replies
sunny_talwar

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

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

Sergey_Shuklin
Specialist
Specialist

Hello, Michael!

Try

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

Anil_Babu_Samineni

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

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

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).

sunny_talwar

Actually it worked for me with the single quotes

Capture.PNG

Anonymous
Not applicable
Author

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.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

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?

sunny_talwar

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