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
Anonymous
Not applicable

DAX: Distinct counts based on data parameters

I need to know the proper DAX to accommodate a couple of data filters on an allocation table.

I need to get headcount that can be filtered by Month where the employee has a start date before on the 1st day of the filtered month AND where their end date is either blank or less than the last day of that filtered month.

An example would be I filter on March:

I want all employees that have a start date <= 3/31/2019 and an end date that is blank or >= 3/1/2019

 

How do I write a general DAX formulat that takes into count what the filtered month is. I don't want to hard code dates into anything.

Head Count =
CALCULATE (
DISTINCTCOUNT ( Table[Employee ID] ),

where
Table[Start Date] <= Filtered Month (last day of that month)
AND
(Table[End Date] ISBLANK OR Table[End Date]>= Filtered Month( the first day of that filtered month)

1 REPLY 1
Anonymous
Not applicable

Please search this forum. There are many examples of such a calculation here.

Best
Darek

Helpful resources

Announcements
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.

June 2025 community update carousel

Fabric Community Update - June 2025

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