Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Classify based on in-app user selection

I am having trouble with an app where the user can select a region where the customer originated then see if the customer used a facility in their region.  Here is an example dataset :

LOAD Facility.Region, Customer.Region, Volume inline [

Facility.Region, Customer.Region, Volume

1, 1, 100

1, 2, 200

1, 3, 300

2, 2, 200

2, 4, 300

3, 1, 300

3, 3, 400];

The desired out come is classifying a facility as 'In' our 'Out' of market based on the user selection of the customer region.

Example: user selects customer region = 2 then facility region 2 classified as 'In' and facility region 1 & 3 as 'Out'. My problem is that facility region 2 get classified as both 'In' and  'Out' when I use if(customer.region = facility.region, 'In','Out'). I am not sure where to begin if set analysis is the best way.

4 Replies
Miguel_Angel_Baeyens

What are the criteria to keep in or out? If a value is the same in both fields, it is both In and Out, unless you apply additional filters

Mark_Little
Luminary
Luminary

Hi Ryan,

Like Miguel has suggested some more information would be great on the logic defining in and out.

If you just want to get the Facility.regoin that matches a selected value try something like

if( facility.region = GetFieldSelections(customer.region), 'In','Out').


Mark

Anonymous
Not applicable
Author

the criteria for 'In' is if the facility region is 'In' the list of customer regions that the user has chosen.

Anonymous
Not applicable
Author

I think I got it, but other please feel free to evaluate:

aggr(max(if(facility.region = customer.region,1,0)),facility.region)

if others have suggestion to refine the approach I am interested.