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: 
arpitkharkia
Creator III
Creator III

Date format issue

Hi all,

PFA the qlikview app. I want the dimension YearMonth as Jan-2017, Feb-2017 from 12017, 22017 and so on.

Thanks for your help!

15 Replies
arpitkharkia
Creator III
Creator III
Author

But buddy im getting it in that format. Should i use len() or other string functions?

sergio0592
Specialist III
Specialist III

Try with :

Load *,
if(len(YearMonth)=5, date(date#(YearMonth,'MYYYY'),'MMM-YYYY'), date(date#(YearMonth,'MMYYYY'),'MMM-YYYY')) as newfield
Resident Table;

arpitkharkia
Creator III
Creator III
Author

Should i use len() or other string functions?

prma7799
Master III
Master III

Use if condition with len function Like Jean said

if(len(YearMonth)=5, date(date#(YearMonth,'MYYYY'),'MMM-YYYY'), date(date#(YearMonth,'MMYYYY'),'MMM-YYYY')) as Newfield

tresesco
MVP
MVP

You are right. Try this:

Date(Date#(Num(YearMonth,'000000'),'MMYYYY'),'MMM-YYYY') as "Month Year"

ElizaF
Creator II
Creator II

Another solution is:

Table:

LOAD

Date(MakeDate(right(YearMonth,4),left(YearMonth,Len(YearMonth)-4)),'MMM YYYY') as YearMonth

;

LOAD * INLINE [

    YearMonth

    12017

    22017

    32017

    42017

    52017

    62017

    72017

    82017

    92017

    102017

    112017

    122017

];