Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld May 10-12, Online and Free! REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
andymanu
Creator II
Creator II

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
sunny_talwar

May be this

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

View solution in original post

3 Replies
sunny_talwar

May be this

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

View solution in original post

andymanu
Creator II
Creator II
Author

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
Creator III
Creator III

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.