Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
sk88024
Creator
Creator

Year and Month Format - YYYY_MM

 Hi All,

I have a requirement where the following Date Field (contains Year and Month only) needs to be converted into YYYY_MM format. Can somebody please advise on this. I have tried few options form my side but they are not giving the expected output. 

Input YearMonth Output YearMonth
2019_32019_03
2020_12020_01
2019_102019_10
2019_112019_11

 

The transformation is highlighted in blue/bold in Output YearMonth.  

Thank you!

Regards,

SK

1 Solution

Accepted Solutions
Taoufiq_Zarra

Hi,

Maye be ;

Date(Date#([Input YearMonth],'YYYY_MM'),'YYYY_MM') as [Output YearMonth]

output :

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

3 Replies
Taoufiq_Zarra

Hi,

Maye be ;

Date(Date#([Input YearMonth],'YYYY_MM'),'YYYY_MM') as [Output YearMonth]

output :

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
sunny_talwar

May be this

Date(MakeDate(SubField(YearMonth, '_', 1), SubField(YearMonth, '_', -1)), 'YYYY-MM') as YearMonth
sk88024
Creator
Creator
Author

Thanks Taoufiq. It worked. I was missing the second YYYY_MM in my trials. 

Regards,

SK