# Qlik Sense App Development

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

## 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)

• ### year

1 Solution

Accepted Solutions
Highlighted MVP & Luminary

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

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
3 Replies MVP & Luminary

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

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

talk is cheap, supply exceeds demand Partner

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

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 🙂

Highlighted MVP & Luminary

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

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