Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
MEBG93
Creator
Creator

Locking a Value in Set Analysis

Hello experts, 

I need to lock a value in a set analysis and maintain that selection in spite of other selections being made by the same dimension. Let me explain briefly:

I need to lock a region, for instance NYC. So I go:

  • sum({<Region={'NYC'}>}Sales) 

But, the user can also select other Region, like LA. What I want is to lock NYC and maintain its value, whether the user selects other region.

I tried with no success:

  • sum({<Region={'NYC'}, Region>}Sales) 
  • sum({1<Region={'NYC'}, Region>}Sales) 
  • sum({$<Region={'NYC'}, Region>}Sales) 

Thanks in advance!

Labels (5)
1 Solution

Accepted Solutions
E_Røse
Creator II
Creator II

I am not sure exactly what you want. If you want to ignore selections from all fields, and have Region ='NYC' and ID=1, then 

  • sum({1<ID={'1'}, Region={'NYC'}>}Sales) 

should work. If it is not, can you provide an example where you do not get what you want?

View solution in original post

6 Replies
Or
MVP
MVP

sum({<Region={'NYC'}>}Sales) will always display sales for NYC, regardless of selections made in the Region field. Note that other selections can impact this - for example, if you select Country = Canada, this expression would presumably return 0 since there are no rows for Region = NYC and Country = Canada.

MEBG93
Creator
Creator
Author

Thanks @Or . What about if i select another value from another dimension on the set analysis, but i still want to show the values for NYC regardless of any other selections made by the user.

A sample table:

ID, Region, Sales

1, NYC, 123

2, NYC, 321

1, Canada, 258

2, Canada, 852

i want to show the first row regardless of any selection made by the user, so I tried locking the Region dimensions like, with no success:

sum({<ID={'1'}, Region={'NYC'}, Region>}Sales)

Any suggests?

vinieme12
Champion III
Champion III

i believe this is what you may be looking for

sum({<Region+={'NYC'}>}Sales) 

+=  will add "NYC' to any selection, 

example

1) if Nothing is selected = Shows DATA for ALL REGIONS

2) if Canada is selected = SHOWS DATA for CANADA + NYC

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Or
MVP
MVP

If you would like to add NYC to any selection made, use Region+={'NYC}. By default this will show all values (when no selections are made).

If you would like to display NYC only by default, and if a selection is made, only show that selection + NYC, I typically use something along the lines of:

If(GetSelectedCount(Region)>0,sum({<ID={'1'}, Region+={'NYC'}, Region>}Sales), sum({<ID={'1'}, Region={'NYC'}, Region>}Sales))

E_Røse
Creator II
Creator II

I am not sure exactly what you want. If you want to ignore selections from all fields, and have Region ='NYC' and ID=1, then 

  • sum({1<ID={'1'}, Region={'NYC'}>}Sales) 

should work. If it is not, can you provide an example where you do not get what you want?

MEBG93
Creator
Creator
Author

Thanks Elin, putting the 1 at the start of the Set Analysis locks the selections made in the SA.

I wasn't having any results due a missing mapping in the region field.