cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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

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

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors