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

Related function - Count specific amount of values

Hello, I am comparing customer names from two different columns to find any mismatches. I am using the following formula:

 

MismatchCusName = IF (
'SRC_Customers'[CUSTOMER_NAME] = RELATED ( 'ECS_EZQuery44'[Customer_Name]),
"Match",
"Mismatch")
 
The problem is that one of the columns does not have the complete name (limited amount of characters) and this gives me a mismatch. For example: The name in one column is complete - Baseball Academy Carlos Ortiz C.A.  / The name on the other column is limited: Baseball Academy Carlos Ort
 
Is there a way to use the related function to count only the first 12 characters from the customer name tables, and compare them to see if they match?
1 ACCEPTED SOLUTION

HI  @Anonymous 

You just need to adjust the formula as below:

LEFT(RELATED ('ECS_EZQuery44'[Customer_Name]), 12)

MismatchCusName = IF (
(LEFT('SRC_Customers'[CUSTOMER_NAME],12)) = LEFT(RELATED ('ECS_EZQuery44'[Customer_Name]), 12),
"Match",
"Mismatch")

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

Check if you can use mid/left  function in comparison

 

left(table[name],12)

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Proud to be a Datanaut Connect on Linkedin

Anonymous
Not applicable

MismatchCusName = IF (
(LEFT('SRC_Customers'[CUSTOMER_NAME],12)) = RELATED (LEFT('ECS_EZQuery44'[Customer_Name], 12)),
"Match",
"Mismatch")
 
Thank you, I get the following error.
Function RELATED expects a fully qualified column reference as its argument. 

HI  @Anonymous 

You just need to adjust the formula as below:

LEFT(RELATED ('ECS_EZQuery44'[Customer_Name]), 12)

MismatchCusName = IF (
(LEFT('SRC_Customers'[CUSTOMER_NAME],12)) = LEFT(RELATED ('ECS_EZQuery44'[Customer_Name]), 12),
"Match",
"Mismatch")

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.