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

Month Year Field

Hi,

i have a date field in the format of dd/mm/yyyy.

i want to create another field which uses the date field to get it in the format of mm/yyyy, so i can use it as a dimension on a graph.

What is the qlikview code to do this?

Thanks

Laura

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Create a field like below in your table.

Month(Date_Field) & '/' & Year(Date_Field) AS MonthYear

so that you can use the MonthYear field in your graphs as dimensions.

Thanks,

Leni

View solution in original post

7 Replies
perumal_41
Partner - Specialist II
Partner - Specialist II

Hi Laura,

Use this Script Syndex Date(Field1,'MMM/YYYY').

Regards,

Perumal.A

Anonymous
Not applicable
Author

Create a field like below in your table.

Month(Date_Field) & '/' & Year(Date_Field) AS MonthYear

so that you can use the MonthYear field in your graphs as dimensions.

Thanks,

Leni

Not applicable
Author

Hi , This worked to some extent but it has created several of the same dates.

It hasnt grouped the data in the same month and year.

Any advice?

Thanks

Laura

perumal_41
Partner - Specialist II
Partner - Specialist II

Hi Laura,

Try this script Date(makedate(year(today()),month(today()),Day(today())),'MMM/YYYY')

Regards ,

Perumal A

orital81
Partner - Creator III
Partner - Creator III

Try using This:

Date(YourDateField,'MM/YYYY').

Not applicable
Author

The new problem is that it will not sort them in Date Order

i have tried all the combinations of the sort properties but none of them work.

Any ideas?

Anonymous
Not applicable
Author

Hi,

The field Month(Date_Field) & '/' & Year(Date_Field) AS MonthYear is a string because we are concatenating two fields. So it will sort in an alphabetical order.

If you want to sort them in Date order then use the below one:

Date(Monthstart(Date_field), 'MMM/YYYY') as MonthYear

Thanks,

Leni