Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
mahitham
Creator II
Creator II

if match condition help

Hi Experts,

Can any one please help me on below requirement.

I have to create one new field  from below mentioned 4 fields (Entity, Feedback, Start date and end date ) named [T/N Product] with 2 records i.e., Trending Product and Non Trending Product records

based on existing fields condition using if match expression.

Conditions:

if  Entity  = Sales then Trending Product

if  Entity  = Manager then Non Trending Product but only if Feedback = Yes else Trending Product

If  Entity  = Products  then Non Trending Product but only if Feedback =No  and (End date -start date)<=3years

if  Entity  = Rating then Trending Product

if any new field added at Entity it has to be treated as Trending Product

Entity            Feedback          Start date            end date

Sales                Yes                  01/02/2015          05/01/2018

Manger            No                    01/02/2017          05/01/2018

Products                                    01/02/2017          05/01/2018

Rating

Please help me on this.

Thanks in advance.

1 Solution

Accepted Solutions
dapostolopoylos
Creator III
Creator III

I suspect the Entity field values may contain extra spaces...

Try this version

If(Match(Trim(Entity), 'Sales', 'Rating'), 'Trending Product',

    If(

          (Trim(Entity) = 'Manager' and Feedback = 'Yes') or (Trim(Entity) = 'Products' and Feedback = 'No' and (Year(End Date)-Year(Start Date)) <=3) or (Match(Trim(Entity),'Testing','Production')),

          'Non Trending Product',

          'Trending Product'

          )

)

Father/Husband/BI Developer

View solution in original post

10 Replies
dapostolopoylos
Creator III
Creator III

There you are....

if(Match(Entity,'Sales','Rating'),

     'Trending Product',

     if((Entity='Manager' and Feedback='Yes') or (Entity='Products' and Feedback='No' and (Year(End Date)-Year(Start Date))<=3),

          'Non Trending Product'),

          'Trending Product'

          )

)

Father/Husband/BI Developer
mahitham
Creator II
Creator II
Author

Hi,

Could you please help me on this.

stalwar1

jyothish8807

dapostolopoylos
Creator III
Creator III

There it is

if(Match(Entity,'Sales','Rating'),

    'Trending Product',

    if((Entity='Manager' and Feedback='Yes') or (Entity='Products' and Feedback='No' and (Year(End Date)-Year(Start Date))<=3 or Match(Entity,'Testing','Production')),

          'Non Trending Product'),

          'Trending Product'

          )

)

Father/Husband/BI Developer
mahitham
Creator II
Creator II
Author

Hi,

Thanks for your help. But I am getting error in expression.

dapostolopoylos
Creator III
Creator III

Paste your expression here

Father/Husband/BI Developer
sunny_talwar

Corrected some parenthesis

If(Match(Entity, 'Sales', 'Rating'), 'Trending Product',

    If(

          (Entity = 'Manager' and Feedback = 'Yes') or (Entity = 'Products' and Feedback = 'No' and (Year(End Date)-Year(Start Date)) <=3) or (Match(Entity,'Testing','Production')),

          'Non Trending Product',

          'Trending Product'

          )

)

mahitham
Creator II
Creator II
Author

HI Sunny,

Now the error removed but expression not working.

By filtering Entity='Testing' not getting 'Non Trending Product' in the new field.


Thanks in advacne

sunny_talwar

Can you share an image of a table box where you add Entity, Feedback, EndDate, StartDate and this new expression as dimensions?

dapostolopoylos
Creator III
Creator III

I suspect the Entity field values may contain extra spaces...

Try this version

If(Match(Trim(Entity), 'Sales', 'Rating'), 'Trending Product',

    If(

          (Trim(Entity) = 'Manager' and Feedback = 'Yes') or (Trim(Entity) = 'Products' and Feedback = 'No' and (Year(End Date)-Year(Start Date)) <=3) or (Match(Trim(Entity),'Testing','Production')),

          'Non Trending Product',

          'Trending Product'

          )

)

Father/Husband/BI Developer