Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Segmentation - Several attributes - Expression if or and

Hi Qlik friends,

I just spent half day trying to solve something maybe you can give me a correct guideline about it... In my dashboard, I want to create a label to one object according with having or not some specific characteristics, is a basic segmentation process made by if and or statements...

I tryed in two ways: Load Script and Expressions:

Load Script:

Segmentacion:

load [Id Cliente],

[Clasificacion Ims],

Categ,

HeavyEnterogermina,

HeavyFloratil,

Pres_Floratil,

if(Categ=1 or Categ=2 or Categ=3 and [Clasificacion Ims]='AA' OR [Clasificacion Ims]='A' AND HeavyEnterogermina='Si' AND HeavyFloratil='No' AND Pres_Floratil='NoFloratil', 'Tier 1 Plus',

if(Categ=1 or Categ=2 or Categ=3 and [Clasificacion Ims]='AA' OR [Clasificacion Ims]='A' AND HeavyEnterogermina='No' AND HeavyFloratil='No' AND Pres_Floratil='NoFloratil', 'Tier 1',

if(Categ=1 or Categ=2 or Categ=3 and [Clasificacion Ims]='AA' OR [Clasificacion Ims]='A' AND HeavyEnterogermina='No' AND HeavyFloratil='Si' AND Pres_Floratil='SiFloratil', 'Tier 2 plus',

if(Categ=1 or Categ=2 or Categ=3 and [Clasificacion Ims]='AA' OR [Clasificacion Ims]='A' AND HeavyEnterogermina='No' AND HeavyFloratil='No' AND Pres_Floratil='SiFloratil', 'Tier 2',

IF(Categ=4 or Categ=5 or IsNull(Categ) AND [Clasificacion Ims]='AA' OR [Clasificacion Ims]='A', 'Tier 3',

IF(Categ=4 or Categ=5 or IsNull(Categ) AND [Clasificacion Ims]='B' OR [Clasificacion Ims]='C' OR [Clasificacion Ims]='N/C' OR IsNull([Clasificacion Ims]), 'Tier 4',

)))))) as Tier

and in Expression Tab

=if(Categ=1 or Categ=2 or Categ=3 and [Clasificacion Ims]='AA' OR [Clasificacion Ims]='A' AND HeavyEnterogermina='Si' AND HeavyFloratil='No' AND Pres_Floratil='NoFloratil', 'Tier 1 Plus',

if(Categ=1 or Categ=2 or Categ=3 and [Clasificacion Ims]='AA' OR [Clasificacion Ims]='A' AND HeavyEnterogermina='No' AND HeavyFloratil='No' AND Pres_Floratil='NoFloratil', 'Tier 1',

if(Categ=1 or Categ=2 or Categ=3 and [Clasificacion Ims]='AA' OR [Clasificacion Ims]='A' AND HeavyEnterogermina='No' AND HeavyFloratil='Si' AND Pres_Floratil='SiFloratil', 'Tier 2 plus',

if(Categ=1 or Categ=2 or Categ=3 and [Clasificacion Ims]='AA' OR [Clasificacion Ims]='A' AND HeavyEnterogermina='No' AND HeavyFloratil='No' AND Pres_Floratil='SiFloratil', 'Tier 2',

IF(Categ=4 or Categ=5 or IsNull(Categ) AND [Clasificacion Ims]='AA' OR [Clasificacion Ims]='A', 'Tier 3',

IF(Categ=4 or Categ=5 or IsNull(Categ) AND [Clasificacion Ims]='B' OR [Clasificacion Ims]='C' OR [Clasificacion Ims]='N/C' OR IsNull([Clasificacion Ims]), 'Tier 4',

))))))

Howver the result is not the same as I get using filters with the same attributes or characteristics

3 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Try below expression.

if((Categ=1 or Categ=2 or Categ=3) and ([Clasificacion Ims]='AA' OR [Clasificacion Ims]='A') AND HeavyEnterogermina='Si' AND HeavyFloratil='No' AND Pres_Floratil='NoFloratil', 'Tier 1 Plus',

if((Categ=1 or Categ=2 or Categ=3) and ([Clasificacion Ims]='AA' OR [Clasificacion Ims]='A') AND HeavyEnterogermina='No' AND HeavyFloratil='No' AND Pres_Floratil='NoFloratil', 'Tier 1',

if((Categ=1 or Categ=2 or Categ=3) and ([Clasificacion Ims]='AA' OR [Clasificacion Ims]='A')AND HeavyEnterogermina='No' AND HeavyFloratil='Si' AND Pres_Floratil='SiFloratil', 'Tier 2 plus',

if((Categ=1 or Categ=2 or Categ=3) and ([Clasificacion Ims]='AA' OR [Clasificacion Ims]='A') AND HeavyEnterogermina='No' AND HeavyFloratil='No' AND Pres_Floratil='SiFloratil', 'Tier 2',

IF((Categ=4 or Categ=5 or IsNull(Categ)) AND ([Clasificacion Ims]='AA' OR [Clasificacion Ims]='A'), 'Tier 3',

IF((Categ=4 or Categ=5 or IsNull(Categ)) AND ([Clasificacion Ims]='B' OR [Clasificacion Ims]='C') AND [Clasificacion Ims]='N/C' AND IsNull([Clasificacion Ims]), 'Tier 4',

)))))) as Tier

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Wow!!!

Thank you very much!!!!!!!!!!

Anonymous
Not applicable
Author

Hi Guillermo,

We're glad to see you got the solution you were looking for. Please take a moment to mark replies as correct or helpful, in order to give credit to those who helped you and to designate this thread as Answered.

For more information, see Qlik Community Tip: Marking Replies as Correct or Helpful

Thank you,

Qlik Community Team