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

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

Reply
Lara1105
New Member

Multiple selection of dates in filter slicer working for a measure

Hello Community,

I am still very new to Power BI and especially DAX coding. I am trying my best to describe my problem:

 

I have two tables,
Active[ID]: numeric, one ID per doctor
Active[DateFrom]: start date
Active[DateTo]: end date or blank if ID is still valid
this table includes all active doctors that do exist in a specific area
and then I have another table which includes only those doctors who offer an appointment at a date in this specific area:
Appointment[ID]: numeric, one ID per docotor
Appointment[Date]: date


I want to set the number of doctors that offer appointments in relation to the number of all existing doctors and I want to do this by filtering a date.
For Appointment[ID] I can simply use DISTINCTCOUNT and a filter slicer, no problem.
But the filter slicer is not so easily working for the Acitve[ID] as I have a date from and date to there.
So I need DISTINCTCOUNT(Active[ID]) to change when selecting dates via my filter slicer of Appointment[Date].
With the help of google and the following measure I made it so far that this distinctcount changes when I select one date and when no date (so all dates) are selected:


PickThis =
var _selectedDate = SELECTEDVALUE(Appointment[Date])
return
IF(
ISBLANK(_selectedDate), CALCULATE(DISTINCTCOUNT(Active[ID])),
CALCULATE(DISTINCTCOUNT(Active[ID]), ALL(Active[DateFrom],Active[DateFrom]), Active[DateFrom] <= _selectedDate && (Active[DateTo] >= _selectedDate || ISBLANK(Active[DateTo] )))
)


Still missing is the case of multiple selections. At the moment I get the same numbers as if no data is seleced. Can anybody help?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Lara1105 , Seem like very similar to the HR blog

Power BI: HR Analytics - Employees as on Date: https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

If need use the file attached

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

View solution in original post

2 REPLIES 2
Lara1105
New Member

Thank you so much, this helped me for remodeling my measure!

amitchandak
Super User
Super User

@Lara1105 , Seem like very similar to the HR blog

Power BI: HR Analytics - Employees as on Date: https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

If need use the file attached

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

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.