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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
zagzebski
Creator
Creator

First date of the year


I have a field with just the year (ie 2013, 2014)

I need to turn the year into the first day of the year:

For instance 2014 would turned to 01/01/2014, 2013 would be turned to 01/01/2013, etc.

Any help?

Steve

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

YearStart() takes a date as parameter - not a year. The question was how to convert a year - a number approx equal to 2000 - to a date corresponding to Jan 1st (which is a number approximately equal to 40000).

The simplest way to do this is to use MakeDate(), which does exactly this. It returns the correct date, formatted as a date. No need for the Year()-function or for the Date()-function.

HIC

View solution in original post

12 Replies
MK_QSL
MVP
MVP

YearStart(Year)  as FirstDateofYear

agilos_mla
Partner - Creator III
Partner - Creator III

Alternative to yearstart is makedate(Y[,M,D])

makedate(2014)  returns 01/01/2014 since Month and Day parameters are omitted,

ie makedate (2014,5) returns 01/05/2014 (as May 1st)

Rgds

Michael

hic
Former Employee
Former Employee

YearStart() will not work. It takes a date (numeric value of around 40000 for today's dates) and not a year as parameter.

MakeDate() is the function you should use.

HIC

MK_QSL
MVP
MVP

File enclosed.

Not applicable

You can use MakeDate function and then use Date function to change into customized data format like below:

=Date(MakeDate(2014),'DD-MM-YYYY')

Thanks,

Angad

Anonymous
Not applicable

You can use YearStart() with Min() and then use Date function to change into customized data format like below:

=Date(Min(YearStart(2014)),'DD-MM-YYYY')

Not applicable

Wouldn’t Year(YearStart(FIELD)) work?

hic
Former Employee
Former Employee

YearStart() takes a date as parameter - not a year. The question was how to convert a year - a number approx equal to 2000 - to a date corresponding to Jan 1st (which is a number approximately equal to 40000).

The simplest way to do this is to use MakeDate(), which does exactly this. It returns the correct date, formatted as a date. No need for the Year()-function or for the Date()-function.

HIC

Anonymous
Not applicable

Here I want date to be displayed as 23 April 2017 for previous year calendar

23rd april 2018 ( today -1) for current year

how to apply using triggers ?