Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Announcing the newest addition to the Qlik Community, Qlik Gallery! Learn More
stefano27
New Contributor

Dynamic Field name as Variable within Set Analysis

Hello,

I'm trying to evaluate a variable within a set analysis and it does not want to evaluate as it did before the last November Service release. Setup goes as follows:

INLINE table with filed names(@ContributionFN) and Listbox (@ContributionOption) selection

Load * INLINE [

@ContributionNum, @ContributionOption, @ContributionFN

1, 12 Month Option,DSImpactIND12,

2, 18 Month Option,DSImpactIND18,

3, 24 Month Option,DSImpactIND24,];

variable used in set analysis

SET eCMOption =@ContributionFN;

Set Analysis

LET eCYCM   = 'SUM({$<$'&'(eCMOption)'&'={1}>}ContributionMargin)';

So each time a value is selected in the listbox(@ContributionOption) the variable with evaluate for the new selection. I have tried a few options and none seem to work... Encasing the variable in square brackets, or changing the tick marks to chr(39) or listing the variable with no $ expansion. Any help is greatly appreciated. Thank you. 

1 Solution

Accepted Solutions

Re: Dynamic Field name as Variable within Set Analysis

Ok, in that case I think you only need to add an equal sign to eCMOption variable:

SET eCMOption = =@ContributionFN; //2 equals, first one to assign value, second to be part of the variable content

6 Replies

Re: Dynamic Field name as Variable within Set Analysis

I really didn't understand, What you are trying. May be Add Equal(=) sign like

LET eCYCM   = '=SUM({$<$'&'(eCMOption)'&'={1}>}ContributionMargin)';

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)

Re: Dynamic Field name as Variable within Set Analysis

Hi Stefan, by default that expression will sum the contribution margin from records with @ContributionFN=1 (a fixed 1), and I don't see a record with that value.

Maybe it should be SET eCMOption =@ContributionNum; // To show always the 12 month option in eCYCM variable

stefano27
New Contributor

Re: Dynamic Field name as Variable within Set Analysis

Hi Ruben,

The expression does not evaluate the values inside the set so it just sums the contribution margin. I'm trying to sum up Contribution Margin for the different types of flags in the application (DSImpactIND12, 18, 24) which are 0 or 1. Thank you. 

stefano27
New Contributor

Re: Dynamic Field name as Variable within Set Analysis

Hi Anil,

I'm trying to sum Contribution Margin for the different DSImpactIND flags. Those can be 0 or 1. Thank you for your answer.

Re: Dynamic Field name as Variable within Set Analysis

Ok, in that case I think you only need to add an equal sign to eCMOption variable:

SET eCMOption = =@ContributionFN; //2 equals, first one to assign value, second to be part of the variable content

stefano27
New Contributor

Re: Dynamic Field name as Variable within Set Analysis

The extra = for the set variable did the trick. Thank you so much for your response and your time and explanation. Regards