Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get YearMonth field from a timestamp

Hi I have a normal time field with date and time. i use

date(floor([Execution Date]),'MMM-YYYY') AS yearmonth

to get the yearmonth. but i still can't aggregate based on that. because I notice in the list box, they show multiple same yearmonth, so the date is still there. how to get rid of date from my yearmonth so that i can calculate based on that. see the picCapture.PNGCapture1.PNG

I guess it is a simple question... maybe it is my way of search but i have not find answers in the forum.

Thanks for the help!

6 Replies
Not applicable
Author

Hi ,

Try the below in your load script:

MonthName(Execution Date) as YearMonth

Thanks,

Shekar!!

sorrakis01
Specialist
Specialist

Hi,

Monthname(date) or

Year(date) & '-' & Month(date)

Regards

Not applicable
Author

Geez...Just so many functions even for date lol thanks man!

maximiliano_vel
Partner - Creator III
Partner - Creator III

Try this

=Dual(Text(Date([Execution Date], 'MMM-YYYY')), Num#(Text(Date([Execution Date], 'YYYYMM'))))

maxgro
MVP
MVP

another way: format as MMM-YYYY the start date of the month

date(floor(MonthStart([Execution Date])), 'MMM-YYYY') as yearmonth

qlikviewwizard
Master II
Master II

Hi Please use this.

SET DateFormat='MMM-YYYY';


Load  date ([Execution Date]) as [Execution Date] INLINE [

Execution Date

JAN-2015

FEB-2015

MAR-2015

];


Hope this will help you.