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

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.

Reply
yosemite
Helper III
Helper III

DAX / Power Query to calculate % of employees working from home, in the field, etc.

Hello everyone,

I'm developing a dashboard to calculate the percentage and/or number of staff:

  • working from home (TELE)
  • in the office (OFFICE)
  • doing field work (Field)
  • on medical leave (ML)

Note that employees can be on a 5-day or 4-day work week. RDO = Regular Day Off. Here's a sample dataset.

WeekEmployee NameSunMonTueWedThurFriSat
04/12/2020 - 04/18/2020Employee1RDOMLMLMLMLMLTELE
04/12/2020 - 04/18/2020Employee2RDOFieldFieldFieldFieldRDORDO
04/19/2020 - 04/25/2020Employee3RDOOfficeOfficeOfficeOfficeOfficeRDO
04/12/2020 - 04/18/2020Employee4RDOTELETELETELETELETELERDO
04/05/2020 - 04/11/2020Employee4RDOTELETELETELETELERDORDO
04/12/2020 - 04/18/2020Employee5RDOTELETELETELETELETELERDO
04/12/2020 - 04/18/2020Employee6RDOTELETELETELETELERDORDO
04/12/2020 - 04/18/2020Employee7RDOTELETELETELETELETELERDO
04/12/2020 - 04/18/2020Employee8RDORDOTELETELETELEOfficeRDO
04/12/2020 - 04/18/2020Employee9RDOFieldTELETELETELETELERDO
04/12/2020 - 04/18/2020Employee10RDOOfficeOfficeOfficeOfficeRDORDO
04/19/2020 - 04/25/2020Employee11RDORDOTELETELETELETELERDO
04/12/2020 - 04/18/2020Employee12RDOTELETELETELETELERDORDO
04/12/2020 - 04/18/2020Employee13RDOTELETELETELETELERDORDO
04/12/2020 - 04/18/2020Employee14RDOFieldFieldFieldFieldRDORDO
04/19/2020 - 04/25/2020Employee15RDOTELETELETELETELERDORDO
04/12/2020 - 04/18/2020Employee16RDORDOTELETELETELETELERDO
04/19/2020 - 04/25/2020Employee17RDORDOTELETELETELETELERDO
04/12/2020 - 04/18/2020Employee18RDOTELETELETELETELERDORDO
04/12/2020 - 04/18/2020Employee19RDOTELETELETELETELERDORDO
04/12/2020 - 04/18/2020Employee20RDORDOTELETELETELETELERDO

 Thank you. 

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @yosemite , 

I am not clear about your requirement, you could refer to my sample for details. If this is not what you want,   could you please inform me more detailed information(such as your expected output and your sample data (by OneDrive for Business))? Then I will help you more correctly.

Please do mask sensitive data before uploading.

Thanks for your understanding and support.
Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

6 REPLIES 6
AlB
Super User
Super User

Hi @yosemite 

how exactly would you calculate it when you have an employee that has a mix, for instance TELE and Office?

Cheers

Hi @AlB - Thanks for replying.

 

Is there a way to calculate the employees that has a mix?  75% home, 25% in the office or 50% home, 50% in the office?

 

If this is not possible, can I create a rule to exclude these employees and still capture the percentage or number of employees using the rest of the dataset?

dax
Community Support
Community Support

Hi @yosemite , 

I am not clear about your requirement, you could refer to my sample for details. If this is not what you want,   could you please inform me more detailed information(such as your expected output and your sample data (by OneDrive for Business))? Then I will help you more correctly.

Please do mask sensitive data before uploading.

Thanks for your understanding and support.
Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hello @dax - I hope you'll still remember this post. I now have to filter out two values in the Measure. I have to filter out "RDO" and "Weekend".  How do I update the measure below to filter out two values?

 

Measure =
CALCULATE (
COUNT( 'Table'[Value] ),
FILTER( 'Table','Table'[Value]<>"RDO" ) ) / CALCULATE(COUNT('Table'[Value]), FILTER(ALLEXCEPT('Table'[EmployeeName],'Table'[EmployeeNo],'Table'[Weekof]),'Table'[Value]<>"RDO"))
 
Thank you.

Hey @dax - Your solution worked! THANK YOU SO MUCH! 👏

Hello @dax - Let me see if this would work; I'll get back to you.

 

Thanks so much!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors