Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue with Date Fields

Hello,

I am used to having tables which contain a date field that I can convert to month or year by using YearStart(Date) or MonthStart(Date). I now have a month field (1-12) and a Year Field (YYYY). I would like to add a rolling month fields that combines the month and year. Here is what I have given a shot with no luck.

Date(Month Feild & '/' & Year Field ,'MM/YY') as RollingMonth. ;

This script runs with no errors but does not produce the fields that I intended.

Any Help would be appreciated.

Thanks,
Jeff

1 Solution

Accepted Solutions
erichshiino
Partner - Master
Partner - Master

you can use makedate( YearField, MonthField)

I guess that if you want to use date, it`s going to be

Date#(Month Feild & '/' & Year Field ,'MM/YY')

or

Date(Month Feild & '/' & Year Field ,'MM/YYYY')

Hope it helps,

Erich

View solution in original post

5 Replies
spividori
Specialist
Specialist

Hi.

Try the following:

date(monthstart([Date]),'MMM YY') as RollingMonth.

Regards.

Not applicable
Author

Hi Sandro,

Thanks for the quick response. My issue is that I do not have a full date feilds (mm/dd/yy) I only have a month field and a Year field. Can a make a rolling month by combining and using the date function?

Thanks Again,

Jeff

prieper
Master II
Master II

You may also use the internal function MONTHNAME(YourDate).

Peter

erichshiino
Partner - Master
Partner - Master

you can use makedate( YearField, MonthField)

I guess that if you want to use date, it`s going to be

Date#(Month Feild & '/' & Year Field ,'MM/YY')

or

Date(Month Feild & '/' & Year Field ,'MM/YYYY')

Hope it helps,

Erich

spividori
Specialist
Specialist

Another option could be:

date(monthstart(date('01.'&[Month Feild]&'.'&[Year Field])),'MMM YY') as RollingMonth

Regards.