cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
elmarcinpbi Frequent Visitor
Frequent Visitor

Using Null in "OR" Filter in Complex Calculate Measure

I am attempting to write a calculate measure in Power BI desktop that determines if a person was enrolled in program during a given month.  When a person is enrolled, the Enrolled Date is set, and the Disenrolled Date = null.  When they are disenrolled, the disenrolled date is set.  Since a person can enroll more than once, I cant just set a flag to indicate enrolled. 

 

 

I put together some syntax from other posts that looks like this:

 

Active Patients = CALCULATE (Countrows(PatientHistory),FILTER(PatientHistory,(PatientHistory[tkh_EnrolledDate]<=LASTDATE('Calendar'[Date])&&[tkh_DisenrolledDate]>=FIRSTDATE('Calendar'[Date])))||(PatientHistory[tkh_EnrolledDate]<=LASTDATE('Calendar'[Date])&&[tkh_DisenrolledDate]= BLANK() )))   

 

The editor is erroring on the last ), but I suspect it is something else.  Any ideas?

 

Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Sean Super Contributor
Super Contributor

Re: Using Null in "OR" Filter in Complex Calculate Measure

You have an extra closing ) before the || operator

You have 3 there when they should be 2 ))

View solution in original post

2 REPLIES 2
Sean Super Contributor
Super Contributor

Re: Using Null in "OR" Filter in Complex Calculate Measure

You have an extra closing ) before the || operator

You have 3 there when they should be 2 ))

View solution in original post

elmarcinpbi Frequent Visitor
Frequent Visitor

Re: Using Null in "OR" Filter in Complex Calculate Measure

thank you, That fixed the syntax.

 

 

Since this table can have records that have enrolled date and disenrolled date with enrolled date, both, or none populated, I wanted to restrict the results set to only those that have ever been enrolled.

 

I created a calculated column that set a flag if Enrolled Date <> Blank() and used that as a filter in the visual.  Working now.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 190 members 2,576 guests
Please welcome our newest community members: