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

Top Solution Authors