Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

Tags (2)
1 Solution

Accepted Solutions

Re: How to make a MonthYear format?

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

5 Replies

Re: How to make a MonthYear format?

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
New Contributor III

Re: How to make a MonthYear format?

you can do:

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

Not applicable

Re: How to make a MonthYear format?

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

Employee
Employee

Re: How to make a MonthYear format?

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

Re: How to make a MonthYear format?

Thank you sir! it does solve my problem

thanks again.

Community Browser