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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jivens
Regular Visitor

Merge queries not returning matches

Hi all,

 

I'm merging two tables in Power Query and it's not returning matches when I know there should be (my dataset is small at this stage and I can basically see the matches with the naked eye 🙂

 

The columns I'm selecting to match are in the same format (text), with the same case and no trailing spaces.

The strings of text in these columns are a bit long (~60 characters) and do not have the same length across rows - could that be the reason? Anything else I might be missing?

 

Thank you!!

 

Jiv

1 ACCEPTED SOLUTION

Hi Jiv,

 

It looks like your TableA [DD_REL] column has a double-space before each of the '#1' parts.

Try right-clicking on the TableA[DD_REL] column header and select Replace Values. Then replace "  " (double-space) with " " (single space), then do the merge after this step. That worked for me:

Table.ReplaceValue(PreviousStepName, "  ", " ", Replacer.ReplaceText, {"DD_REL"})

 

BA_Pete_0-1698648730981.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

5 REPLIES 5
jivens
Regular Visitor

Thank you SOOOO much, that was indeed the issue. It's fixed and I'm doing a happy dance!!

v-xinruzhu-msft
Community Support
Community Support

Hi @jivens 

1.You can remove the space of the DD_REL column in two tables

Table A

vxinruzhumsft_0-1698632202528.png

Table B

vxinruzhumsft_1-1698632253351.png

 

2.Then combine the two table 

vxinruzhumsft_2-1698632278237.png

 

Output

vxinruzhumsft_3-1698632322362.png

 

You can refer to the attachment.

 

Best Regards!

Yolo Zhu

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

 

jivens
Regular Visitor

Thank you for your time!!

None of the tips did the trick... here's what my data looks like. I'm trying to merge using the column "DD_REL".

Table A

subjectnameDD_REL
00599-00200599-002VALUE A -  #1
00503-00700503-007VALUE C -  #1

Table B

subjectnamerecordidDDYNDD_REL
00599-0021Yes00599-002VALUE A - #1
00847-0031No00847-003VALUE A - #1
00503-0091No00503-009VALUE A - #1
00503-0151Yes00503-015VALUE A - #1
00847-0021No00847-002VALUE A - #1
00503-0081No00503-008VALUE A - #1
00847-0011No00847-001VALUE A - #1
00503-0101No00503-010VALUE A - #1
00847-0041No00847-004VALUE A - #1
00503-0071No00503-007VALUE A - #1
00599-0041No00599-004VALUE A - #1
00599-0051No00599-005VALUE A - #1
00503-0111No00503-011VALUE A - #1
00599-0061No00599-006VALUE A - #1
00503-0141No00503-014VALUE A - #1
00847-0051No00847-005VALUE A - #1
00599-0011No00599-001VALUE A - #1
00847-0021No00847-002VALUE B - #1
00847-0041No00847-004VALUE B - #1
00503-0101No00503-010VALUE B - #1
00599-0021No00599-002VALUE B - #1
00503-0091No00503-009VALUE B - #1
00503-0111No00503-011VALUE B - #1
00599-0041No00599-004VALUE B - #1
00847-0011No00847-001VALUE B - #1
00599-0051No00599-005VALUE B - #1
00599-0061No00599-006VALUE B - #1
00847-0031No00847-003VALUE B - #1
00503-0071No00503-007VALUE B - #1
00503-0081No00503-008VALUE B - #1
00599-0011No00599-001VALUE B - #1
00847-0051No00847-005VALUE B - #1
00599-0011No00599-001VALUE C - #1
00847-0051No00847-005VALUE C - #1
00847-0031No00847-003VALUE C - #1
00503-0081No00503-008VALUE C - #1
00847-0041No00847-004VALUE C - #1
00599-0051No00599-005VALUE C - #1
00847-0011No00847-001VALUE C - #1
00847-0021No00847-002VALUE C - #1
00503-0072No00503-007VALUE C - #2
00599-0061No00599-006VALUE C - #1
00503-0071Yes00503-007VALUE C - #1
00503-0141 00503-014VALUE C - #1
00599-0041No00599-004VALUE C - #1
00599-0021No00599-002VALUE C - #1
00599-0041No00599-004VALUE D - #1
00599-0061No00599-006VALUE D - #1
00503-0111No00503-011VALUE D - #1
00503-0081No00503-008VALUE D - #1
00503-0141 00503-014VALUE D - #1
00847-0011No00847-001VALUE D - #1
00847-0021No00847-002VALUE D - #1
00847-0031No00847-003VALUE D - #1
00503-0071No00503-007VALUE D - #1
00599-0051No00599-005VALUE D - #1
00503-0151 00503-015VALUE D - #1
00599-0011No00599-001VALUE D - #1
00847-0051No00847-005VALUE D - #1
00599-0021No00599-002VALUE D - #1
00847-0041No00847-004VALUE D - #1

Hi Jiv,

 

It looks like your TableA [DD_REL] column has a double-space before each of the '#1' parts.

Try right-clicking on the TableA[DD_REL] column header and select Replace Values. Then replace "  " (double-space) with " " (single space), then do the merge after this step. That worked for me:

Table.ReplaceValue(PreviousStepName, "  ", " ", Replacer.ReplaceText, {"DD_REL"})

 

BA_Pete_0-1698648730981.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




BA_Pete
Super User
Super User

Hi Jiv,

 

Power Query supports text strings of up to 32,766 (unicode) characters, so I don't think that's the issue.

In my experience, it's usually one of the following fixes, in rough order of likelihood:

 

-1- Refresh the result preview by going to the Home tab > Refresh Preview

-2- Trim the matching columns in both tables (Transform tab > Format > Trim)

-3- Upper- or lower-case the matching columns in both tables (Transform tab > Format > UPPERCASE or lowercase)

-4- Clean the matching columns in both tables (Transform tab > Format > Clean)

 

I've not listed matching the Data Types as the Merge dialog should give you a warning for this.

 

If none of these work, then you'll need to provide a small amount of anonymised sample data from each matching table to see if the issue can be reproduced and fixed accordingly.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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
Top Kudoed Authors