Qlik Sense App Development

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

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save \$400. Learn More
New 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)
• Difference between to dates in years and months

1 Solution

Accepted Solutions
Partner

Re: Difference between to dates in years and months

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
4 Replies
Partner

Re: Difference between to dates in years and months

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

Re: Difference between to dates in years and months

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)

Highlighted
Honored Contributor II

Re: Difference between to dates in years and months

maybe like this:

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

Thank you