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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.