Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable issue

MarketEmpCityCity Emp
AA2NN9
BB3NN9
CC4NN9
DD5ZZ6
AA1ZZ6

Dear All,

Can we create a variable for 2 selection like :

1. vMarket= If(Match(Market,'AA','BB','CC') AND Match(City,'NN'),Emp)

2. vMarket= Sum({<Market= {'AA','BB','CC'},C]City={'NN'}>}City Emp)

If not plz tell me..How I can take the value of Emp in my expression as variable.. I have to take both the selection in one variable..

Plz reply soon..

3 Replies
Not applicable
Author

A variable can only hold a single value at any one time. In your first example vMarket could equal 2, 3 or 4 so would not make sense.

Can you explain what you are trying to do?

Maybe you want to create a new calculated field instead? You would do that in the load script, e.g.

LOAD

     Market,

     Emp,

     City,

     [City Emp],

     If(Match(Market,'AA','BB','CC') AND Match(City,'NN'), Emp, 0) as MyField

FROM

     MyTable;

"MyField" would then contain a positive Emp value or zero if there is no match.

swuehl
MVP
MVP

Not really sure what you are trying to achieve.

1. should work if there is only one possible value for both Market and City (e.g. you've selected one value in each field).

2. is not correct syntax, something like

=only({<Market= {'AA'}, City={'NN'}>} Emp)


should work, returning 2, regardless of selections in Market and City.

Anonymous
Not applicable
Author

You can create a variable and the value of the variable can be varied based on the activation/deactivation of the other sheet objects.

For any sheet object in the actions>external>set variable, you can define the value of that variable.

In this way on activation of the sheet objects the value of the same variable can be changed.