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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
shaher12
Frequent Visitor

total numbers of employees tell today

hi i have table called vw_Basicinfo have these columns Date Of Joining , Employee Id,Employee Status and LAST_WORKING_DATE so i need to get total employees count whose the Employee Statusis Active and LAST_WORKING_DATE is null and need it grouped monthly mean I need to sum of total employees for each month depending on Date Of Joining if filterd by any month show me the total employees tell this month

1 ACCEPTED SOLUTION

This query will group the data by year and month of the Date Of Joining column, and count the number of employees for each group. The result will be a table with columns for the year, month, and total number of employees.

If you want to filter the data by a specific month, you can add a WHERE clause to the query. For example, to filter by January 2023, you can use this query:

 

SELECT
YEAR([Date Of Joining]) AS [Year],
MONTH([Date Of Joining]) AS [Month],
COUNT([Employee Id]) AS [Total Employees]
FROM vw_Basicinfo
WHERE [Employee Status] = 'Active' AND LAST_WORKING_DATE IS NULL
AND [Date Of Joining] <= '2023-01-31'
GROUP BY YEAR([Date Of Joining]), MONTH([Date Of Joining])
ORDER BY [Year], [Month]

 

This query will return the total number of employees for each month up to and including January 2023.

 

View solution in original post

3 REPLIES 3
Alef_Ricardo_
Resolver II
Resolver II

Hi there! 😊

If you want to get the total count of employees whose Employee Status is Active and LAST_WORKING_DATE is null, grouped by month, you can use a SQL query like this:

SELECT
YEAR([Date Of Joining]) AS [Year],
MONTH([Date Of Joining]) AS [Month],
COUNT([Employee Id]) AS [Total Employees]
FROM vw_Basicinfo
WHERE [Employee Status] = 'Active' AND LAST_WORKING_DATE IS NULL
GROUP BY YEAR([Date Of Joining]), MONTH([Date Of Joining])
ORDER BY [Year], [Month]

This query will group the data by year and month of the Date Of Joining column, and count the number of employees for each group. The result will be a table with columns for the year, month, and total number of employees.

If you want to filter the data by a specific month, you can add a WHERE clause to the query. For example, to filter by January 2023, you can use this query:

 

SELECT
YEAR([Date Of Joining]) AS [Year],
MONTH([Date Of Joining]) AS [Month],
COUNT([Employee Id]) AS [Total Employees]
FROM vw_Basicinfo
WHERE [Employee Status] = 'Active' AND LAST_WORKING_DATE IS NULL
AND [Date Of Joining] <= '2023-01-31'
GROUP BY YEAR([Date Of Joining]), MONTH([Date Of Joining])
ORDER BY [Year], [Month]

 

This query will return the total number of employees for each month up to and including January 2023.

 

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors