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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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