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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Kudoed Authors