Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
saadaouianouar
Partner - Contributor II
Partner - Contributor II

Help Expression : calculate the number of people who work less than a year

Hello guys,

I would like to calculate the number of people who work less than a year.

in my data warehouse I do not have the variable which contains the deference between two dates: deference  date of entry date and date of exit 

(year([ExitD])-year([EntryD]))*12 +( num(month([ExitD]))-num(month([EntryD])))+1  it's working

now i want to calculate the number of employees who had work less than twelve months.

the SQL query which I want to create with 

select  count( id_trav)  FRom travail where Trunc(Months_Between(ExitD+1,EntryD))<12

Labels (7)
1 Solution

Accepted Solutions
Gysbert_Wassenaar

That's probably because you're using a rather strange way to calculate the months.
For example, if ExitD is the 20180201 and the EntryID is 20170228 then you calculate the months as
(2018-2017)*12 + (2-2) + 1 = 13. And if you look at the dates then you can see that the person was really employed for less than a year. In fact closer to 11 months then 13 months.

If you don't want to use the Age function then plug in your expression instead.

talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Perhaps something like this:
count({<EmployeeID={"=Age(ExitD,EntryD)=0"}>} distinct EmployeeID)

talk is cheap, supply exceeds demand
saadaouianouar
Partner - Contributor II
Partner - Contributor II
Author

thank you but the solution that you proposed doesn't exactly work because there's an exception because there's one employee who has 12 months but it's counting him and is it possible to have indicator without the age function

Thank you for your time 🙂

Gysbert_Wassenaar

That's probably because you're using a rather strange way to calculate the months.
For example, if ExitD is the 20180201 and the EntryID is 20170228 then you calculate the months as
(2018-2017)*12 + (2-2) + 1 = 13. And if you look at the dates then you can see that the person was really employed for less than a year. In fact closer to 11 months then 13 months.

If you don't want to use the Age function then plug in your expression instead.

talk is cheap, supply exceeds demand