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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors