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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
rajaurora
Frequent Visitor

Single date filter to count the values between two date ranges

Hello
I have a requirement where a single date filter should be able to filter the date range in a table where the date from calendar table as selected value should check the source table and count employees where the selected date filter from the slicer is Less than equal to Adj Hire date and selected date is GT the term date in the source table

example: If the user select 12/31/2020 the selected value count all the employees who have adj hire date less than equal to 12/31/2020 and all employees who have terminated date Greater than 12/31/2020
Count according to the application is 5073 (for validation)

Any other suggestions also welcome

Thank you for the help

 

rajaurora_0-1626733486472.png

 

 

 

 

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

Hi, @rajaurora ;

According to your description, i create a simple data to count. and create a measure as follows:

count = CALCULATE(COUNT([Employee Id ]),FILTER(ALL(Employee),[Start Date]<=MAX('calendar'[Date])&&[End Date]>MAX('calendar'[Date])))

The final output is shown below:

vyalanwumsft_0-1626919044243.pngvyalanwumsft_1-1626919263325.png

Best Regards,
Community Support Team_ Yalan Wu
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

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @rajaurora ;

According to your description, i create a simple data to count. and create a measure as follows:

count = CALCULATE(COUNT([Employee Id ]),FILTER(ALL(Employee),[Start Date]<=MAX('calendar'[Date])&&[End Date]>MAX('calendar'[Date])))

The final output is shown below:

vyalanwumsft_0-1626919044243.pngvyalanwumsft_1-1626919263325.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@rajaurora , my HR blog should help you that

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

HR Analytics - Employees as on Date : https://youtu.be/e6Y-l_JtCq4

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

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 FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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