Qlik Community

New to Qlik Sense

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

Announcements
Tell us which business and trade publications you read most regularly: RESPOND NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
skkrishna
Contributor III
Contributor III

Removing Number from Text

Hi,

I have a data show as below, I'm expecting output as below.

Products                    Expected_output

Boat                                        Boat

Boat 2022                              Boat

Apple  fruit                         Apple fruit

Apple fruit 2023                Apple fruit

Apple2fruit                          Apple2fruit

Apple2fruit  2022               Apple2fruit 

p2p                                              p2p

p2p 2022                                   p2p

 

if it has number(basically the number is year, year can be any year irrespective of what it is showing above) in last four digits it's should not show,

 

Can anyone please help me on this. thanks in advance.

 

1 Reply
Almen
Creator II
Creator II

Assuming year is always separated by empty space:

if(right(field, 1))>=0, left(field,length(field)-5), field) as NewField