Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
madushanfernand
Contributor III
Contributor III

Create a new count table for a table with intervals

Hi All

following is the data set which i extracted from the data base ( Query 1 and Table 1 ).

can anyone please help me to get the out put as follows ( Table 2 ).

Here is my case :

Table 1 has the employee id and his or her career start date and and career end date.

i want to create a table ( Table 2 ) to get the active employee count for the year and month.

for an instance, if the year is 2018 and month is JAN, then the active employees as of 31/01/2018 count should be calculated as

COUNT (DISTINCT IF (EMP_START_DATE<=MonthEndDate and  MonthEndDate<EMP_END_DATE, EMP_ID))

where MonthEndDate  is 31/01/2018 for the above example.


Can we create the solution table using SQL or Qlikview.? Any of the way is expected.

Your help would be really appreciated.


Thank you

Madushan

Query 1,

Capture1.JPG

Table 1,

Capture2.JPG

Table 2,

Capture3.JPG

1 Solution

Accepted Solutions
mdmukramali
Specialist III
Specialist III

Hi,

find the Attached the file.

View solution in original post

4 Replies
mdmukramali
Specialist III
Specialist III

Hi,

You can follow the Mr. hic‌ below post which will help you to full fill your requirement.

Creating Reference Dates for Intervals

Kindly find the attached application which I have created a sample document based on employee HireDate and EndDate.

if you have any further help do let me know.

Thanks,

Mohammed Mukram.

madushanfernand
Contributor III
Contributor III
Author

Hi Mukram

thanks a lot for your response.

i have gone through the post. but couldn't find which you have attached.

could you please send me the attachment again.

mdmukramali
Specialist III
Specialist III

Hi,

find the Attached the file.

madushanfernand
Contributor III
Contributor III
Author

Hi

thank you very much for your assistance, this is what exactly i wanted.