ID 17 - count the total number of employees in the Employee table.

Max: 45
Try code in DAX.do

Syntax

COUNT COUNTROWS ROW SUM SUMMARIZE SUMMARIZECOLUMNS

Related

26 - Group by occupation and count the occurrences 33 - customer-product combinations that have maximum sales in the Sales table 32 - customer-product combinations that have multiple entries in the Sales table 18 - counts the number of employees whose job description is 'Manager'

SQL

SELECT COUNT(*) AS TotalEmployee 
FROM Employee;

DAX

EVALUATE
SUMMARIZECOLUMNS (
    "TotalEmployee", COUNTROWS ( Employee )
)

Pandas

import pandas as pd

# Sample DataFrame
df = pd.DataFrame({
    'EmployeeID': [1, 2, 3, 4, 5],
    'firstName': ['John', 'Jane', 'Alice', 'Bob', 'Charlie']
})

# Count the total number of employees
total_employees = df.shape[0]

print(total_employees)

Output

TotalEmployee 5

Explanation

COUNTROWS ( Employee ): This counts the number of rows in the Employee table. SUMMARIZECOLUMNS: This function is used to create a table with a single column named TotalEmployee, which contains the count of employees.

Leave a Comment