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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
DanT1994
Helper I
Helper I

Formula to take into account missing data from one dataset

Hi,


I have the following data sets:

 

- List of all employees that have worked for the company (includes start and end date of employment)
- List of shifts worked each month

My end goal is to report on how many of our active employees were/are 'utilised' each month.

The attached screenshot shows what I've achieved so far.  I've managed to get a utilisation figure by dividing 'is employee utilised?' by 'employee count', but the issue I'm having is that it currently doesn't take into account 'Start Date'.  In the example, employee 383 isn't being utilised, but they are an active employee, as their start date is lower than the year/month column.  The reason it doesn't is because they didn't work that month and therefore aren't present on my 'list of shifts worked each month' dataset.

Can anyone think of a way around this?  Ideally I just need to say =If ('start date calc' < 'year/month'), 1,0)...  but this won't work as the employee in question isn't present on the shifts dataset.

Thanks!  Let me know if you need any more info.

Utilisation ReportUtilisation Report

1 REPLY 1
v-kkf-msft
Community Support
Community Support

Hi @DanT1994 ,

 

I am not sure if I understood your question correctly. Is your problem that you can't get the correct number of active employees for the month? If so, please try this measure.

 

MonthActiveEmployees = 
CALCULATE (
    DISTINCTCOUNT ( Employees[ID] ),
    FILTER (
        ALL ( Employees ),
        Employees[Start Date] <= MAX ( shifts[Year/Month] )
            && (
                Employees[End Date] > MAX ( shifts[Year/Month] )
                    || Employees[End Date] = BLANK ()
            )
    )
)

vkkfmsft_0-1652320126046.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.