Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
mridgley
Contributor
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
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

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
Contributor
Contributor
Author

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

mridgley
Contributor
Contributor
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

mridgley
Contributor
Contributor
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

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?