Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
SK28
Creator
Creator

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