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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

August Carousel

Fabric Community Update - August 2024

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