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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Date Slicer that filters to show new employees and leavers

Hi everyone, 

 

I am fairly new to Power BI so apologies if this isn't particularly difficult, any help that can be given would be much appreciated. 

I am working on a report that has a date slicer (using a date table) that should display all employees who have started or left the company within the selected dates. Also any employees that haven't started or left within those dates should be "neither" 

 

I currently have a Calendar Table and Worker table that has Calendar Date, EmployeeEndDate, EmployeeStartDate, Worker ID.

 

I tried creating a calculated column that would display Starter, Leaver and Neither for each calendar date of each worker but it was only showing startes/leavers within a few months

 

sunflower_0-1656092228501.png

 

Any help would be really appreciated please, thank you

 

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @Anonymous ,

 

Inactive the relationship between calendar table and employee table if have relationship.

 

Create a measure like the following:

Measure = 
IF (
    OR (
        SELECTEDVALUE ( 'Table'[EmployeeStartDate] ) >= MIN ( 'calendar'[Date] )
            && SELECTEDVALUE ( 'Table'[EmployeeStartDate] ) <= MAX ( 'calendar'[Date] ),
        SELECTEDVALUE ( 'Table'[EmployeeEndDate] ) >= MIN ( 'calendar'[Date] )
            && SELECTEDVALUE ( 'Table'[EmployeeEndDate] ) <= MAX ( 'calendar'[Date] )
    ),
    1
)

 

Put this measure in filter pane of the table visual which you want to display the employee during the date.

And the output:

vchenwuzmsft_0-1656409735119.gif

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

4 REPLIES 4
v-chenwuz-msft
Community Support
Community Support

Hi @Anonymous ,

 

Inactive the relationship between calendar table and employee table if have relationship.

 

Create a measure like the following:

Measure = 
IF (
    OR (
        SELECTEDVALUE ( 'Table'[EmployeeStartDate] ) >= MIN ( 'calendar'[Date] )
            && SELECTEDVALUE ( 'Table'[EmployeeStartDate] ) <= MAX ( 'calendar'[Date] ),
        SELECTEDVALUE ( 'Table'[EmployeeEndDate] ) >= MIN ( 'calendar'[Date] )
            && SELECTEDVALUE ( 'Table'[EmployeeEndDate] ) <= MAX ( 'calendar'[Date] )
    ),
    1
)

 

Put this measure in filter pane of the table visual which you want to display the employee during the date.

And the output:

vchenwuzmsft_0-1656409735119.gif

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

 

Anonymous
Not applicable

Thank you very much for your response, I will try this and update if this is solution as soon possible!

amitchandak
Super User
Super User

@Anonymous , refer if my blog or attached file can help

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

 

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thank you very much for your response, I will try this and update if this is solution as soon possible!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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