Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
So I'm relatively new to power BI I have a table with the following:
Generic Employees #
Which Department they are in
Whether or not they have been vaccinated
I'd like to create a new table or measure that give me the following:
# of employees in each deparment
# of employees vaccinated by department
% of employees by department
I'm somewhat familiar with DAX.
Thanks in advance!
Solved! Go to Solution.
@kpeterson Those are long column names but:
# Employees = COUNTROWS('Table'[Generic Employee #])
# Vaccinated = COUNTROWS(FILTER('Table',[Whether or not they have been vaccinated] = "Yes"))
% Of Employees = DIVIDE([# Vaccinated],[# Employees],BLANK())
Put those into a table visual along with the column [Which Department they are in]
Hi @kpeterson ,
According to your description, I create some data:
Here are the steps you can follow:
1. Create calculated table.
New Table =
SUMMARIZE(
'Table',
'Table'[Department],
"of employees in each deparment",CALCULATE(COUNT('Table'[Generic Employees]),FILTER('Table','Table'[Department]=EARLIER('Table'[Department]))),
"of employees vaccinated by department",CALCULATE(COUNT('Table'[Generic Employees]),FILTER('Table','Table'[Department]=EARLIER('Table'[Department])&&'Table'[vaccinated]="Yes"))
)
2. Create calculated column.
% of employees by department = DIVIDE('New Table'[of employees vaccinated by department],'New Table'[of employees in each deparment])
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@kpeterson Those are long column names but:
# Employees = COUNTROWS('Table'[Generic Employee #])
# Vaccinated = COUNTROWS(FILTER('Table',[Whether or not they have been vaccinated] = "Yes"))
% Of Employees = DIVIDE([# Vaccinated],[# Employees],BLANK())
Put those into a table visual along with the column [Which Department they are in]
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
83 | |
67 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |