Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Using the 1 in set analysis but allowing certain selections

Hello everybody,

Does any know a way in set analysis that allows you to use the 1 identifier, but also allow user selections?

I want to calculate Sales over the full set where the Red flag = 1. I then want users to be able to select a region and this to be included.

Something like

     SUM({<1{RedFlag={1},Region={$}>}Sales)

So when a user selects a region this is included in the sum.

Any ideas?


1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

This should work:

SUM({1<RedFlag={1}, Region=P(Region)>} Sales)

Regards,

Michael


View solution in original post

13 Replies
MayilVahanan

Hi

Try like this

I think, for your scenerio, this give solution

SUM({<RedFlag={1}>}Sales)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
swuehl
MVP
MVP

Maybe like

  SUM({<1{RedFlag={1},Region={$(=GetFieldSelections(Region,','))}>}Sales)

tresesco
MVP
MVP

Try like:

SUM({<RedFlag={1},Field1=, Field2=, Field3=>}Sales)

Here selection in the field Field1, Field2, Field3 would not be taken into consideration but for the field Region  would be, beacuse that is not included in the set expression.

Anonymous
Not applicable
Author

Hi

This solution is not using the 1 to select over the whole set.

Thanks for the response.

Anonymous
Not applicable
Author

Hi

I can't see what you're saying, but it is not returning a result.

Thanks for the reply.

Anonymous
Not applicable
Author

Hi

I can't see what you're saying, but i have lots of fields.

Thanks for the reply.

MK_QSL
MVP
MVP

As per my knowledge, Set analysis dont allow 1 and selection both together. Obviously you can ignore user selection as per tresesco suggested...

SUM({<RedFlag = {1}, Month = , Year = ,WeekNo = , Qtr =  >}Sales)

Here any selection by user in Month, Year, WeekNo and Qtr will not affect your value but Region selection will give you SUM of SALES for that particular region with RedFlag = 1...

tresesco
MVP
MVP

If you have many fields, Stefan's solution should work with a little bit of correction, please try :

SUM({1<RedFlag={1},Region={$(=GetFieldSelections(Region,','))}>}Sales)

swuehl
MVP
MVP

You should get a result at least when selecting in Region.

If you don't select a region, there might be an issue, right, because all regions will be excluded, so you should see zero as result.

You can try something like this:

=sum({1<RedFlag={1} $(=if(GetSelectedCount( Region ), ', Region = {'& GetFieldSelections(Region) &'}','')) >} Sales)

The dollar sign expansion should evaluate your current selection in Region and - if no selection is made, just return an empty string:

=sum({1<RedFlag={1} >} Sales)

but if a selection is made, eg. North and South, it should return

=sum({1<RedFlag={1}, Region = {North, South} >} Sales)

If your regions look more complicated (i.e. Region values are not just single words), you may need to add quoting, which makes the dollar sign expansion a little more complex.