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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
PCarson00
Frequent Visitor

Unexpected comparison results

I have a power query table which is a merge of two tables. It performs fine but I want to compare two columns with two other columns.

Spec and SPEC (one is PUDPipeData.SPEC)

 

I have added a conditional column with this code:

if Text.StartsWith([PID SPEC], [PUDPipeData.Spec]) then "Match" else "Not Matching"

 

What happens now is the rows double with one "Matching" and one "Not Matching"

 

 

 

PCarson00_2-1704910082610.png

After applying conditional column:

PCarson00_3-1704910274717.png

 

Now slicing by "Not Matching"

PCarson00_4-1704910307359.png

 

As you can see after slicing, the not matching is being applied to everything where it should only work on the S52 one that needs to be S53.

 

I have tried changing the type to text before applying this column, so they are all text columns.

I have also double checked the lower and upper case of the columns and they appear to be correct. Here they are below:

PCarson00_5-1704910420941.png

PCarson00_6-1704910434790.png

 

Here are my steps: 

PCarson00_7-1704910452027.png

 

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @PCarson00 ,

Based on the information you have provided, It seems that the result appears to be a Cartesian product. There are several possibilities that could cause this:
First, check that the relationship between the two tables is not a many-to-many relationship before you merge them. The Cartesian product result often occurs in the case of many-to-many relationships.
If it's not a many-to-many relationship, check what mode you're using for merge.

vjunyantmsft_0-1704964127994.png

For each different mode, the final number of rows returned will vary.
Merge queries overview - Power Query | Microsoft Learn

Best Regards,
Dino Tao
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

2 REPLIES 2
Anonymous
Not applicable

Hi @PCarson00 ,

Based on the information you have provided, It seems that the result appears to be a Cartesian product. There are several possibilities that could cause this:
First, check that the relationship between the two tables is not a many-to-many relationship before you merge them. The Cartesian product result often occurs in the case of many-to-many relationships.
If it's not a many-to-many relationship, check what mode you're using for merge.

vjunyantmsft_0-1704964127994.png

For each different mode, the final number of rows returned will vary.
Merge queries overview - Power Query | Microsoft Learn

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

ronrsnfld
Super User
Super User

You are leaving something out with regard to your process. That formula only returns a single result. Perhaps if you posted your actual code (from the advanced editor) the problem may be clarified.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.