Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Please note that I have updated the description to include the equation.
I am thinking that the issue is because I already have quotes in the IF statement for the variable 'IRRAdverseCase ', but I could be wrong
So you will have only one region selected when you plan to look at this?
I think we need to see what your variable really is. And see what it is evaluating to.
Sounds like the issue may not be in your set analysis expression but in your variable evaluation.
May be try this
=SUM(
{<
Scenario = {'$(=$(IRRAdverseCase))'}
>}
[ParCr])
When US Region or Canada Region is selected
When Asia Region is selected
Please note that when I look at the Variable Overview, it just has the equation:
IF(Region = 'Canada Region',
'Scenario I',
IF(Region = 'US Region',
'Scenario I',
'Scenario II'))
Try this (sample attached in one of the below posts)
=SUM(
{<
Scenario = {'$(=$(IRRAdverseCase))'}
>}
[ParCr])
Thank you very much! This worked perfectly.
For my own knowledge, why would I have to put in a double $?
I guess the issue is that your variable isn't defined with an equal sign, so it needs to be evaluated before it can bed used in the set analysis syntax...
So inner set analysis evaluates it to 'Scenario I' and outer one is used for set analysis...
Alternatively you can define your variable like this
SET IRRAdverseCase = =IF(Region = 'Canada Region', 'Scenario I', IF(Region = 'US Region', 'Scenario I', 'Scenario II'));
And then this should work
=SUM(
{<
Scenario = {'$(=IRRAdverseCase)'}
>}
[ParCr])
Inner dollar sign expansion is not needed because you have an equal sign in your set statement.