Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
kmiryalaj
Contributor
Contributor

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

View solution in original post

6 Replies
lblumenfeld
Partner Ambassador
Partner Ambassador

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.

kmiryalaj
Contributor
Contributor

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

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


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Thanks for the assist. Much appreciated.
Anonymous
Not applicable
Author

Thanks for the help. Appreciate you posting a solution.
Gysbert_Wassenaar

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