Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

How to show values only if it contains 2 names and disregard those with only 1 name

Hi everyone,

 

I need a way to only show rows which have First and Middle Name. 

 

For e.g.

 

Mary Jane

Mark

Bob John

 

The result will only be:

Mary Jane 

Bob John

 

I am trying to use the contains function ...

 

Middle Name = IF(CONTAINS('Table','Table'[First and Middle Name]," "), SUM(FTEandContractor[First and Middle Name]),BLANK())
 
I get the error that the function Sum cannot work with values of type String. How can I achieve this?
1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Create this measure:

Measure =
VAR _name = SELECTEDVALUE('Table'[name])
RETURN IF(SEARCH(" ", _name, 1, -1) > 0, 1, 0)
 
and filter the visual:
 
Capture.PNG
 
Remember to apply a trim function to this column.


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

Proud to be a Super User!



View solution in original post

1 REPLY 1
camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Create this measure:

Measure =
VAR _name = SELECTEDVALUE('Table'[name])
RETURN IF(SEARCH(" ", _name, 1, -1) > 0, 1, 0)
 
and filter the visual:
 
Capture.PNG
 
Remember to apply a trim function to this column.


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

Proud to be a Super User!



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.