Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
Wow!!!
Thank you very much!!!!!!!!!!
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