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
rpiboy
Frequent Visitor

Merge not Finding Matches Against Custom Column

Hi all,

 

I've searched up and down and not found any pertient results for my issue.

 

I've created a custom column that extracts three characters out of a text string. I'm think attempting to do a Merge Query using the Custom Column against a column in another table with the same strings. On the Merge PowerBI says the selection has failed to find any matches and if I do hit Ok I just get null values (which makes sense, since it can't find any matches). However, since I can look at the data I know for a fact I have matches.

 

I should also mention I did recast my custom column as text, as the column in the table I'm attempting to merge in is a Text column.

 

My data source is an MS-SQL DB.

 

Thanks for reading!

-Robert

1 ACCEPTED SOLUTION
kcantor
Community Champion
Community Champion

If you convert to real numbers you will lose the leading zeros. I would keep it as text. Use trim, then clean, then transform to lowercase (even for the numbers) then try it again. I actually just ran into this issue and by cleaning the column first, it worked.





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

Proud to be a Super User!




View solution in original post

9 REPLIES 9
KHorseman
Community Champion
Community Champion

The query editor is case sensitive. Are you sure the text matches in case as well as characters?





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

Proud to be a Super User!




@KHorseman - the character strings I'm looking to match are all numerals, so unless I'm missing something, it doesn't seem likely that is the issue...

 

customcolumntable.PNGloctable.PNG

There might be spaces, blanks or unprintable characters in them. I'd recommend to convert them to "real" number formats and then you should be fine.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

rpiboy
Frequent Visitor

I'll give it a go using PwrBI to convert the columns to numbers. However the data in the Location table was manually entered by me fairly short number of rows and the other data, since its an extraction from a string, I don't see how it could have any misc. characters in it....

Maybe the data in your DB has. With field in "text"-format everything is possible.

Otherwise you can clean and trim both columns instead of converting them to numbers.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

kcantor
Community Champion
Community Champion

If you convert to real numbers you will lose the leading zeros. I would keep it as text. Use trim, then clean, then transform to lowercase (even for the numbers) then try it again. I actually just ran into this issue and by cleaning the column first, it worked.





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

Proud to be a Super User!




Thanks!

 

Clean/Trim/Lowercase helped. I didn't pick through each to determine which one did the trick on which column.

@kcantor

re: leading zeros - exactly why I did it as text, however for the purposes of merging and diagrams it would be a bit inconsequential.

 

re: the transform and cleaning. I would have to perform that function on the custom column and the column being imported with the Location table, correct?

kcantor
Community Champion
Community Champion

@rpiboy

You are correct. Always duplicate the clean, trim, and transform on any columns you are trying to match. I went from matching 1 out of 8257 to all of them by cleaning up the columns.





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.

Top Solution Authors