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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If Condition

  Hi QV,

Will this If condition is fine?Every time it was returing "Others" only.

[Product Owner]  -it was renamed from source field. So do we need to use source field in If cond??I have tried that too but not resolved.

 

IF([Product Owner] ='AR2' or 'E04' or 'E06' or 'E08' or 'N01' or 'N05' or 'N06' or 'N08' or 'N09','PC',
IF([Product Owner] ='AR5' or 'AR6' or 'EU1' or 'EU2','CP',
IF([Product Owner] ='E01' or 'E02' or 'E03' or 'E05' or 'E07' or 'E09','ServiceLA','Others'))) as [Business Segment],

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Load Something Like below

Load

     *,

     IF([Product Owner] ='AR2' or [Product Owner] ='E04' or [Product Owner] ='E06' or [Product Owner] ='E08' or [Product Owner]='N01' or [Product Owner] ='N05' or [Product Owner] ='N06' or [Product Owner] ='N08' or [Product Owner] ='N09','PC',
IF([Product Owner] ='AR5' or [Product Owner] ='AR6' or [Product Owner] ='EU1' or [Product Owner] ='EU2','CP',
IF([Product Owner] ='E01' or [Product Owner] ='E02' or [Product Owner] ='E03' or [Product Owner] ='E05' or [Product Owner]='E07'or 'E09','ServiceLA','Others'))) as [Business Segment];

Load

     *,

     TextBetween([Product Owner - Product Owner Level 01 (Key)] , '[' , ']',2) as [Product Owner],

      ...

     ...

From tablename;

View solution in original post

7 Replies
MK_QSL
MVP
MVP

IF([Product Owner] ='AR2' or [Product Owner] ='E04' or [Product Owner] ='E06' or [Product Owner] ='E08' or [Product Owner] ='N01' or [Product Owner] ='N05' or [Product Owner] ='N06' or [Product Owner] ='N08' or [Product Owner] ='N09','PC',
IF([Product Owner] ='AR5' or [Product Owner] ='AR6' or [Product Owner] ='EU1' or [Product Owner] ='EU2','CP',
IF([Product Owner] ='E01' or [Product Owner] ='E02' or [Product Owner] ='E03' or [Product Owner] ='E05' or [Product Owner] ='E07' or 'E09','ServiceLA','Others'))) as [Business Segment],

vijay_iitkgp
Partner - Specialist
Partner - Specialist

You can simplify by using match/ Wildmatch function

IF( Wildmatch([Product Owner] ,'AR2' , 'E04' , 'E06' , 'E08' , 'N01' 'N05' ,'N06' , 'N08' , 'N09'),'PC',
IF(Wildmatch([Product Owner] ,'AR5' , 'AR6' , 'EU1' , 'EU2'),'CP',
IF(Wildmatch([Product Owner] ,'E01' , 'E02' , 'E03' , 'E05' , 'E07' , 'E09'),'ServiceLA','Others'))) as [Business Segment],

Not applicable
Author

Thanks Manish for your quick response but still have some issue

Field not found - <Product Owner>

[Product Owner]  -it was renamed from source field. So do we need to use source field in If cond??

Thanks

MK_QSL
MVP
MVP

Provide your original script.... if you have

[YourOldFieldName] as [Product Owner]

in the same table load you need to replace [Product Owner] from my given code with [YourOldFieldName]

IF([Product Owner] ='AR2' or [Product Owner] ='E04' or [Product Owner] ='E06' or [Product Owner] ='E08' or [Product Owner]='N01' or [Product Owner] ='N05' or [Product Owner] ='N06' or [Product Owner] ='N08' or [Product Owner] ='N09','PC',
IF([Product Owner] ='AR5' or [Product Owner] ='AR6' or [Product Owner] ='EU1' or [Product Owner] ='EU2','CP',
IF([Product Owner] ='E01' or [Product Owner] ='E02' or [Product Owner] ='E03' or [Product Owner] ='E05' or [Product Owner]='E07' or 'E09','ServiceLA','Others'))) as [Business Segment],


So in above code Replace [Product Owner] with [YourOldFieldName]

Not applicable
Author

 

yes i have repleced and tried that too but not resolved.

here is Product Owner script.

TextBetween([Product Owner - Product Owner Level 01 (Key)] , '[' , ']',2) as [Product Owner],

Thanks

MK_QSL
MVP
MVP

Load Something Like below

Load

     *,

     IF([Product Owner] ='AR2' or [Product Owner] ='E04' or [Product Owner] ='E06' or [Product Owner] ='E08' or [Product Owner]='N01' or [Product Owner] ='N05' or [Product Owner] ='N06' or [Product Owner] ='N08' or [Product Owner] ='N09','PC',
IF([Product Owner] ='AR5' or [Product Owner] ='AR6' or [Product Owner] ='EU1' or [Product Owner] ='EU2','CP',
IF([Product Owner] ='E01' or [Product Owner] ='E02' or [Product Owner] ='E03' or [Product Owner] ='E05' or [Product Owner]='E07'or 'E09','ServiceLA','Others'))) as [Business Segment];

Load

     *,

     TextBetween([Product Owner - Product Owner Level 01 (Key)] , '[' , ']',2) as [Product Owner],

      ...

     ...

From tablename;

Not applicable
Author

Thanku Manish