The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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
Solved! Go to 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.
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.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
21 | |
19 | |
19 | |
18 | |
14 |
User | Count |
---|---|
42 | |
35 | |
24 | |
20 | |
20 |