Qlik Community

Ask a Question

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor II
Contributor II

Creating a date in the current year with same MM/DD as older date.

Hello clever people. Need some assistance with dates please.

We track some MI on our employee longevity so that we can acknowledge employee anniversaries for key milestones. I am loading information from a Sybase DB and base everything off the Employee_Start_Date.  

If the start date is 11/16/2008 I would like to create a date reflective of this year so 11/16/2018. I can therefore easily subtract the two dates and see that the employee is celebrating 10 years with the firm. This needs to carry forward for future years too.  

In EXCEL is can do this by =DATE(YEAR(NOW()),MONTH(H2),DAY(H2)) where H2 is the start date.

I am not having much success getting this same result in Qlikview. HELP...

Labels (2)
1 Solution

Accepted Solutions
Contributor
Contributor

Makedate(Year(today()),Month(H2),Day(H2)) should work.

View solution in original post

6 Replies
Luminary
Luminary

This formula below works with the data in my sample script when I paste it in a Text object.

=Date(Num(Month(H2)) & '/' & Day(H2) & '/' & Year(Now()))

In my script for this example, I loaded a one-record table with the date you provided.

Dates:
Load * Inline [
Key, H2
1, 11/16/2008
];

You may have to adjust it to your data. Please post a sample of what you're using, in the event that it doesn't work when you plug it in.

I hope this helps.

Contributor
Contributor

Makedate(Year(today()),Month(H2),Day(H2)) should work.

View solution in original post

MVP & Luminary
MVP & Luminary

You can use the SetDateYear function: SetDateYear('11/16/2008', 2018) -> 11/16/2018


talk is cheap, supply exceeds demand
Contributor II
Contributor II

Thanks for the assist. Much appreciated.
Contributor II
Contributor II

Thanks for the help. Appreciate you posting a solution.
MVP & Luminary
MVP & Luminary

You're welcome. Since you accept it as a solution, would you mind marking it as a solution as well?

talk is cheap, supply exceeds demand