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: 
nehapathak
Contributor II
Contributor II

Months between 2 dates

I have 2 date fields "Hire date" and "Report date"

I want to calculate the number of employees who have joined in last six months from the report date.

How do we calculate the months b/w 2 dates.

for eg-

Report date is 30/6/2017 and hire date is 30/12/2016 it should give me 6 as answer

1 Solution

Accepted Solutions
martinpohl
Partner - Master
Partner - Master

=(year(today())-year(hiredate))*12                              // number of years * 12

+( num(month(today()))-num(month(hiredate)))          // + number of months

+1                                                                                // plus 1

Regards

View solution in original post

4 Replies
arulsettu
Master III
Master III

maybe this

'month(Report date)-month(Hire date)

nehapathak
Contributor II
Contributor II
Author

I have tried this but it doesn't return the correct value if the year is different

martinpohl
Partner - Master
Partner - Master

=(year(today())-year(hiredate))*12                              // number of years * 12

+( num(month(today()))-num(month(hiredate)))          // + number of months

+1                                                                                // plus 1

Regards

sunny_talwar

You need to count people who joined between 1/1/2017 and 30/6/2017?

May be this

Count(DISTINT {<DateField = {"$(='>=' & Date(MakeDate(2017, 1, 1), 'D/M/YYYY') & '<=' & Date(MakeDate(2017, 6, 30), 'D/M/YYYY'))"}>} EmpID)