cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sunflower
Frequent Visitor

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 @sunflower ,

 

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 @sunflower ,

 

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.

 

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

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

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

 



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s || 50+Power Query List Functions : Learn Power Query List
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

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

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Show episode 9

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 26

New Date - Check it Out!

Mark your calendars and join us on Thursday, October 6 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors