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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
08748190
Contributor II
Contributor II

Difference between to dates in years and months

Hello everyone,

I want to get the difference between two dates in year and month in my case i want mesure the seniority of salary

x by calcul the diffence between current date and hiring date. i used the function AGE to retourn the diffence.

For exemple: AGE(05/08/2019-05/04/2016) retourn 3 but i want to get 3,4 (years+months).

My question is how i get the diffence between two date in years and months ? thank you in advance.

Labels (1)
1 Solution

Accepted Solutions
JordyWegman
Partner - Master
Partner - Master

Hi,

You can try:

Floor( (DateEnd-DateStart) / 365) 
+ 
(
 (
   (DateEnd-DateStart) / 365) - Floor( (DateEnd-DateStart) / 365)
  )
 / (365-12)
)

It's not a beautiful formula, but its exactly giving you the years and months.

Jordy

Climber

Work smarter, not harder

View solution in original post

4 Replies
JordyWegman
Partner - Master
Partner - Master

Hi,

You can try:

Floor( (DateEnd-DateStart) / 365) 
+ 
(
 (
   (DateEnd-DateStart) / 365) - Floor( (DateEnd-DateStart) / 365)
  )
 / (365-12)
)

It's not a beautiful formula, but its exactly giving you the years and months.

Jordy

Climber

Work smarter, not harder
settu_periasamy
Master III
Master III

Maybe like this

=Age(MakeDate(2019,08,05),MakeDate(2016,04,05))&','&Mod(Floor((MakeDate(2019,08,05) - MakeDate(2016,04,05))/30.4),12)

Frank_Hartmann
Master II
Master II

maybe like this:

=date(interval(date#('05/08/2019','DD/MM/YYYY')- date#('05/04/2016','DD/MM/YYYY')),'YY-MM')
08748190
Contributor II
Contributor II
Author

Thank you