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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Create YYYYMM Field from Load

Hi All,

How do i create a new Field that contains Year and Month

e.g

201501

201502

201503

and so on.

Please provide Examples

Thanks.

28 Replies
alexandros17
Partner - Champion III
Partner - Champion III

You create a YYYMM field starting from a date field, so let's suppose your date field is SalesDate then

Load

...

SalesDate,

year(SalesDate)*100 + Month(SalesDate) as YearMonthField,

...

rubenmarin

Hi Thabiso, as an example, if you have a field named DateField, you can do:

LOAD Date(DateField, 'YYYYMM') as YearMonth

...

Not applicable
Author

Hi Alessandro,

Im trying to Combine two Fields Year and Month Fields to make them as one Field YearMonth

Thanks

vishsaggi
Champion III
Champion III

Hi Thabiso,

Try this might work.

DateEg:

LOAD ID, Date(Date, 'YYYYMM') As Date;

LOAD * INLINE [

    ID, Date

    1, 2015-01-01

    2, 2015-02-22

    3, 2015-08-20

    4, 2015-04-22

];

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Date(MakeDate(Year, Month), 'YYYYMM') as YearMonth

-Rob

alexandros17
Partner - Champion III
Partner - Champion III

So:

Load

...

Year*100 + Month as YearMonthField,

...

buzzy996
Master II
Master II

try with rwunderlich suggestion,tht will works 100%.

vijetas42
Specialist
Specialist

Hi,

You can use QlikView Date functions like,Date('Date_Field',Format of Date) where you can specify 'YYYYMM'

Not applicable
Author

Hi Shiva,

It dosent work that solution, it makes the Field Blank.