Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

condition to new fieldname

Can you help me out im new here and I need to create condition from existing field name (year) to new field name. It is like befor 2000 should be it named old and after 2000 should be new. I have tried several script but it is not working for me.

My last one was

IF( YEAR(Lietadlo_Zaciatok_Prevadzky) <=1989, 'Sucasny') as Lietadlo_Klasifikacia

thanks

1 Solution

Accepted Solutions
sunny_talwar

Yes that could be the issue, the date format may be text. You can try this:

If(Year(Date#(Date, 'DD.M.YYYY')) < 2000, 'Old', 'New') as Flag

This may or may not work, but no harm in trying this.

Best,

S

View solution in original post

6 Replies
sunny_talwar

I don't really understand the field names, but generally speaking, something like this should work for you:

If(Year(Date) < 2000, 'Old', 'New') as Flag (or whatever you want to call it)

HTH

Best,

S

Anonymous
Not applicable
Author

Yes you can use sunindia solution to create a flag and then use it to your expression .

If you want two fields Old and New

then you can use

Load

Col1

.

.

.

Date as Date,

If(Year(Date) <= 2000, Date) as Old,

If(Year(Date) > 2000, Date) as New


from ....file


now you have two columns New and old and can use as required.


Thanks


BKC




Not applicable
Author

Thank you, I have it like that but it still have it only one in a row like OLD. it depend on date format??? now have it I like 15.5.1990

sunny_talwar

Yes that could be the issue, the date format may be text. You can try this:

If(Year(Date#(Date, 'DD.M.YYYY')) < 2000, 'Old', 'New') as Flag

This may or may not work, but no harm in trying this.

Best,

S

Not applicable
Author

worked,thanks a lot:)


sunny_talwar

No problem! I am glad it worked.

Best,

S