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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
marksmunich
Creator III
Creator III

resolving and fixing the field value

Hello Community,

I have a problem in my application with a field. The values in this field are uneven. how can i fix it. i want to make all the values in the format year_Month. below is the image.

Year_Month.JPG.jpg

Thanks

Mark

6 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Do you have 2 possible formats? Then, when loading the different date fields in your script, test for the presence of an underscore. If it isn't there, format the purely numerical value with date(date#(NumericalDateValue, 'YYYYMM01'), 'YYYY_MM') or something.

Peter

sunilkumarqv
Specialist II
Specialist II

Try like this

Date(Date,'DD/MM/YYYY')

or

use in script

Set DataFormat='DD/MM/YYY'

sivarajs
Specialist II
Specialist II

purgechar(field,'_')

Use in script or list box expression

maxgro
MVP
MVP

if you have mixed format you can use the alt function

M:

LOAD YM, date(alt(date#(YM, 'YYYY_MM'), Date#(YM, 'YYYYMM')), 'YYYY_MM') as NewYM;

LOAD * INLINE [

    YM

    2014_01

    2014_02

    201403

    201404

];

er_mohit
Master II
Master II

Try this in script

date(Date#(PurgeChar(Datefield,'_'),'YYYYMM'),'YYYYMM') AS Date

or

date(PurgeChar(Datefield,'_'),'YYYYMM') AS Date

preminqlik
Specialist II
Specialist II

hi try this

date(date#(replace(TransDate,'_',null()),'YYYYMM'),'YYYYMM')               as               NEWDate