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

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