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: 
niha
Creator II
Creator II

Date Format

Hello, 

I have a Yearmonth Field and the code is : 

Year(Date(Date#([Date Paid],'YYYY/MM/DD'))) &num( Month(Date(Date#([Date Paid],'YYYY/MM/DD')))) as DPYearmonth,

it comes below format but user want the format like 201701. 201702, 201703 so on. Please suggest

Untitled.pngRegards,

Niha

3 Solutions

Accepted Solutions
sunny_talwar

Try this

Date(MonthStart(Date#([Date Paid],'YYYY/MM/DD')), 'YYYYMM') as DPYearmonth,

View solution in original post

marcus_sommer

You could do it in this way:

Year(Date#([Date Paid],'YYYY/MM/DD')) * 100 + Month(Date#([Date Paid],'YYYY/MM/DD'))

- Marcus

 

View solution in original post

niha
Creator II
Creator II
Author

Thanks all. it worked.

View solution in original post

4 Replies
sunny_talwar

Try this

Date(MonthStart(Date#([Date Paid],'YYYY/MM/DD')), 'YYYYMM') as DPYearmonth,
marcus_sommer

You could do it in this way:

Year(Date#([Date Paid],'YYYY/MM/DD')) * 100 + Month(Date#([Date Paid],'YYYY/MM/DD'))

- Marcus

 

niha
Creator II
Creator II
Author

Hi,

I wanted to add few more. i have two date format. 

1. I need the Year month to come like 201701, 201702, 201703......201601 so on...

2.  I also need to sort like 201601, 201602, 201603 s.........201701, 201702 in both cases. Please advice

Untitled.pngNiha

niha
Creator II
Creator II
Author

Thanks all. it worked.