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
SarahHope
Helper I
Helper I

Syntax for Calculated Column to Filter results from three fields using OR logic

Hello!

I'm brand new to Power BI. I'm trying to create a calculated column containing a filter for three other columns in the same data sheet using OR logic.


I want a calculated column showing me all changes that will need post implementation review.  I want to name that column "PIR" and I want a Boolean result in that column

 

Change Type = "Emergency Change"

OR
Expedited = True

OR

Resulted in Outage = True

 

I've tried a number of configurations and tried to follow examples I have found in help forums.  But I'm just not getting it. 

This is what I have for starters:

PIR = FILTER('Full SharePoint Export'[Expedited]=True || 'Full SharePoint Export'[Change Type] = "Emergency Change" || 'Full SharePoint Export'[Resulted in Outage] = TRUE)
My syntax is incorrect.
I could really use a little help.
Thanks!
Sarah

 

1 ACCEPTED SOLUTION

@FreemanZ - Thank you SO much!  That gets me much closer. 

What is the significance of the TRUE, TRUE, FALSE at the end?

I like to understand why I am doing what I'm doing.

 

Apparently, since the 'Change Type' field is not boolean and the other two fields are,  FILTER is giving me an error.

So, I am trying to make another calculated column called "Emergency" that returns "True" for any change where Change Type = "Emergency Change"

 

 I have tried this:

Emergency = CONTAINS(FILTER('Full SharePoint Export'[Change Type]),"Emergency Change")
But am getting "too few arguements were passed to the FILTER function."
 
I'll keep researching and let you know if I figure it out.  I'd be happy for advice too!
 
Thanks,
Sarah

View solution in original post

3 REPLIES 3
FreemanZ
Super User
Super User

hi @SarahHope 

try like:

PIR = 
IF('Full SharePoint Export'[Expedited]=TRUE || 'Full SharePoint Export'[Change Type] = "Emergency Change" || 'Full SharePoint Export'[Resulted in Outage] = TRUE, TRUE, FALSE)

@FreemanZ I've got it!

 

Emergency = CONTAINSSTRING('Full SharePoint Export'[Change Type],"Emergency Change")
This works!

 

I also learned that the field for "Resulted in Outage" looked like True/False, but it wasn't.  I changed it. 

 

Everything works.

I'm still wondering what the TRUE, TRUE, FALSE) at the end of the statement you provided means.

That's not urgent, but I would like to know.  

 

Also, I want to accept the solution with a caveat - Can I do that?

"This solution works as long as all the fields are True/False"

@FreemanZ - Thank you SO much!  That gets me much closer. 

What is the significance of the TRUE, TRUE, FALSE at the end?

I like to understand why I am doing what I'm doing.

 

Apparently, since the 'Change Type' field is not boolean and the other two fields are,  FILTER is giving me an error.

So, I am trying to make another calculated column called "Emergency" that returns "True" for any change where Change Type = "Emergency Change"

 

 I have tried this:

Emergency = CONTAINS(FILTER('Full SharePoint Export'[Change Type]),"Emergency Change")
But am getting "too few arguements were passed to the FILTER function."
 
I'll keep researching and let you know if I figure it out.  I'd be happy for advice too!
 
Thanks,
Sarah

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