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

Multiple Filter Conditions in a Measure

I am trying to calculate an employee count based on these conditions:

 

TermDate is blank  or (TermDate > 4/1/2019 and Term Date <= 6/30/2019)

 

I have tried many combinations and it's not working.  Here is my what I currently have the count is not correct.

 

TEST2 =
       CALCULATE ( DISTINCTCOUNT(ResourceAllocationFact[EmployeeID]),
        FILTER(EmployeeDim, EmployeeDim[TermDate]= blank() 
        || EmployeeDim[TermDate]> 4/1/2019
        || EmployeeDim[TermDate]<=6/30/2019)
         )

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous

The || means OR on DAX the AND syntax is made by && so believe that you should rephrase your measure to:

TEST2 =
CALCULATE (
DISTINCTCOUNT ( ResourceAllocationFact[EmployeeID] ),
FILTER (
EmployeeDim,
EmployeeDim[TermDate] = BLANK ()
|| ( EmployeeDim[TermDate] > 4 / 1 / 2019
&& EmployeeDim[TermDate] <= 6 / 30 / 2019 )
)
)

Regards,
MFelix

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @Anonymous

The || means OR on DAX the AND syntax is made by && so believe that you should rephrase your measure to:

TEST2 =
CALCULATE (
DISTINCTCOUNT ( ResourceAllocationFact[EmployeeID] ),
FILTER (
EmployeeDim,
EmployeeDim[TermDate] = BLANK ()
|| ( EmployeeDim[TermDate] > 4 / 1 / 2019
&& EmployeeDim[TermDate] <= 6 / 30 / 2019 )
)
)

Regards,
MFelix

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



jtownsend21
Responsive Resident
Responsive Resident

Give this a try. 

TEST2 =
CALCULATE ( DISTINCTCOUNT(ResourceAllocationFact[EmployeeID]),
    FILTER(EmployeeDim, 
        OR(EmployeeDim[TermDate]= blank(), 
            AND(EmployeeDim[TermDate]> 4/1/2019,
                EmployeeDim[TermDate]<=6/30/2019
            )
        )
    )
)

IF this doesn't work, can you outline specifically what criteria you need with some sample data and an example of the desired outcome. 

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.