Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

andymanu
Contributor

Filter Data

Hi,

I got a table which looks like below,

  

Item_CodeItem_Name
CBDG3CDA
124567D
DEFAFDE
243671G
ABD256H
AGHDK2N
BCDWH5M

I want to filter the data based on the below requirements;

1. Select the last two characters of the Item_Code. (I may use the Right() function )

2. I want to Flag/Filter the Item_Codes which ONLY got alphabetic letter. Ex- the last two codes cannot have a number.

The out put should be something like below,

  

Item_CodeItem_Name     Flag
CBDG3CDA1
124567D0
DEFAFDE1
243671G0
ABD256H0
AGHDK2N0
BCDWH5M0

Could anyone help me to accomplish the above task would be greatly appreciated.

Regards,

Andy

1 Solution

Accepted Solutions

Re: Filter Data

May be this

If(Len(PurgeChar(Right(Item_Code, 2), '0123456789')) = 2, 1, 0) as Flag

3 Replies

Re: Filter Data

May be this

If(Len(PurgeChar(Right(Item_Code, 2), '0123456789')) = 2, 1, 0) as Flag

andymanu
Contributor

Re: Filter Data

Hi Sunny,

Thank you so much. Yes it worked.

I was bit struggling to combine the Right function and the if condition together as a single combined function.

Regards,

Andy

thi_pham
Contributor

Re: Filter Data

Isnum function can help this case: (https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/Scripting/LogicalFunctio...)

     if(isnum(right(Item_Code,2)) = -1, 0, 1)

I think it works well even in case length of Item_Code < 2.

Community Browser