Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
udden2903
Contributor
Contributor

Set expression to be modified depending on whether the user has filtered on a specific dimension

Dear all,

I have a set expression that will need to be modified depending on whether the user has applied a filter on a specific dimension in my app. The expression looks as follows, where vValue should assume the value of 1 or otherwise be "disabled" depending on whether the user has made a selection on the dimension TerritoryID:

Sum ( {$<MyVariable = vValue>} Sales )

The expression should be evaluated as follows:

If GetSelectedCount(TerritoryID) > 0, then
Sum ( {$<MyVariable = {1}>} Sales )

Otherwise
Sum ( {$<MyVariable = >} Sales )

Combining the above in one If...Then statement will not work for my purposes. 

/ Andreas

Labels (1)
2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Create a new variable, preferably in the script like this:

Set vChooseMyVariable = =if (GetSelectedCount(TerritoryID) > 0, '{1}', '');

Note there are two "=" in the above. 

Then your expression will be:

Sum ( {$<MyVariable = $(vChooseMyVariable)>} Sales )

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

udden2903
Contributor
Contributor
Author

Thanks - works well.

/ Andreas