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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
SatyaPaleti
Creator III
Creator III

How to create a new filter based on another filter values

Hi Everyone,

 

I have small issue can you please help me to resolve this Issue.

I have following countries in field Country

1. India

2. U.S.A

3. Brazil

4. Europe

5. England

6.Malaysia

I need to Create a new field based on these countries. Field name is Country Category

so if country India, Brazil, U.S.A then we have to show Category A

so if country Europe, England, Malaysia then we have to show Category B

If all the Countries  it should be Categories ALL

in Country Category Field i will have 3 Values Category A, Category B & Category ALL.

if User selects Category A then in the filter Country Only India, Brazil, U.S.A  should select

if User selects Category B then in the filter Country Only England, Europe, Malaysia  should select

if User Selects Category ALL then all the Countries should select

I have written like below

if( Country = 'India' or Country = 'Brazil' or  Country = 'U.S.A', 'Category 1',

 if( Country = 'England' or Country = 'Europe' or  Country = 'Malaysia', 'Category 2', 'Category ALL'))

but I am getting only Category A & Category B in filter. Can some one suggest how to Include Category ALL also

Thanks and Regards,

Satya

 

Labels (1)
6 Replies
tresesco
MVP
MVP

For 'All' you need to reload the country field one more time. Try like:

t1:
Load *,
	If(Match(Country, 'India', 'China'), 'Asia',
		if(Match(Country, 'UK', 'FRA'), 'Europe', 'USA')) as Continent Inline [
Country
India,
USA
UK
China
FRA
];
Load
	Country,
	'All' as Continent
Resident t1;
SatyaPaleti
Creator III
Creator III
Author

Hi Treseco,

 

Thank you so much for your response but the above requirement is different

 

Thanks and Regards,

Satya

tresesco
MVP
MVP


@SatyaPaleti wrote:

Thank you so much for your response but the above requirement is different


Would you mind explaining a bit more ? If you have tried the solution I proposed - please try to explain the differences in it's light.  

SatyaPaleti
Creator III
Creator III
Author

Hi Tresco,

 

I need to create a filter based on Countries. 

I have 6 Countries

1. India

2. USA

3.England

4. Brazil

5.Malaysia

6. Europe

if I click on Category A then India, USA  & England should select

if I click on Category B then Brazil, Malaysia  & Europe should select

If i click Category C then all the countries should select

 

Thanks and Regards,

Satya

 

 

tresesco
MVP
MVP

I guess it is not much different, you just need to change the values with same logic. Try:

 

t1:
Load *,
	If(Match(Country, 'India', 'USA', 'England'), 'Category 1',
		if(Match(Country, 'Brazil', 'Malaysia', 'Europe'), 'Category2')) as NewField Inline [
Country
India
USA
England
Brazil
Malaysia
Europe
];
Load
	Country,
	'Category All' as NewField
Resident t1;

 

Hakim-A
Creator
Creator

Hello,

 

I think you should create these categories in your script and then use buttons + variables to select the groups you want