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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
syasmin25
Helper V
Helper V

Count IDs with a date range slicer having met a condition

Hello, 

I am trying to count number of managers that have been using an extra printer a date slicer. The Enter Date and Leave Date columns are from when they started this fiscal year. Also, if the leave date shows blank then it shows today. I have a seperate Date table that has inactive relationships with the Enter Date and Leave Date. How would I be calculating the number of employees that are using an extra printer with a date slicer?



IDPrinterEnter DateLeave Date
204Y6/30/207/16/20
566Y5/4/207/14/20
765N6/30/207/16/20
2 REPLIES 2
amitchandak
Super User
Super User

@syasmin25 ,

Not very clear.

Can you share sample sample output in a table format?

refer if this file can help

https://www.dropbox.com/s/bqbei7b8qbq5xez/leavebetweendates.pbix?dl=0

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello, 

Thank you so much for your help. I am copying over the the the information from your file with an added column here. 

T_sample

idEnter DateLeave DatePassed Test/Not
1Thursday, August 19, 2019Wednesday, April 1, 2020Y
2Thursday, August 18, 2019Friday, March 20, 2020N
3Thursday, October 18, 2019Tuesday, March 31, 2020Y
4Thursday, September 10, 2019Wednesday, May 27, 2020N
5Thursday, August 19, 2019Monday, July 20, 2020Y


I have also connected them in an inactive relationship. The DimDate table is from your file that I have used here.
tEmp.PNG

I am trying to calculate the Number of Users that have passed the test as a sample here. And I will be using the Date Column from DimDate table as slicer.
tbruh.PNG

So far, I have tried the following but I am having issues trying to connect the Leave Date in the formula as well. 

Number of Users that have passed the test =
DIVIDE(
 
COUNTROWS(
CALCULATETABLE( VALUES( sample_tbl[id] ),
FILTER( VALUES( sample_tbl[Enter Date] ),sample_tbl[Enter Date] <= ( DimDate[Date] && CALCULATE(COUNT(sample_tbl[Passed Test/Not]),sample_tbl[Passed Test/Not]="Y") ))))

 

 

Thus, it currently looks somewhat like this.
t_Calendar.PNG
Also, my auto date/time is turned off due to some other date related calculations.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.