Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to make a MonthYear format?

i have a data called dates, and i only need to get the month and year.

and a friend of mine told me to use 'Floor' , 'MonthStart' , 'Date' to extract Month and Year. how can i use these functions in my codes

1 Solution

Accepted Solutions
alexandros17
Partner - Champion III
Partner - Champion III

if your date is 2013 April 14 then:

your monthyear field will be

year(mydate)*100 + month(mydate)

so 2013*100 = 201300 + 4 => 201304

hope it helps

View solution in original post

5 Replies
alexandros17
Partner - Champion III
Partner - Champion III

if your date is 2013 April 14 then:

your monthyear field will be

year(mydate)*100 + month(mydate)

so 2013*100 = 201300 + 4 => 201304

hope it helps

ceciliafujita
Contributor III
Contributor III

you can do:

num(Month(yourdate),00) & Year(yourdate,4) as MonthYear

Not applicable
Author

what i did is date(myDate, 'MMM-YYYY')

hic
Former Employee
Former Employee

Formatting it using Date(myDate, 'MMM-YYY') is the right approach but it only solves half of the problem. It only hides the day part. It does not remove it. If you want to do it properly, you should use a MonthStart() first, i.e.

     Date(MonthStart(myDate), 'MMM-YYYY')

HIC

Not applicable
Author

Thank you sir! it does solve my problem

thanks again.