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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

NATURALINNERJOIN function doesn't work matching a text column

Hi,

in a my pbi model I need to create a new table by DAX to match some columns of two tables created after more power query logics.

In order to accomplish a such task I've used the NATURALINNERJOIN function but unsuccessfully because I've obtained a cartesian product.

I've analyzed my data inside a bit test model and I've noticed that the issue is caused by the unmatching respect to a text column used in the join function. In particular, in the test model I've created manually two tables:

- Tab_A, with the text column named "Code" and an integer column named "obs_value",

- Tab_B, with the text column named "Code" and an integer column named "exp_value".

I've filled the column "Code" of these two tables with a sample value, "aaaa", adding 2 rows for Tab_A and 3 rows for Tab_B.
No relationships exist between Tab_A and Tab_B.

To create the new dax table I've used this function:

TAB_B_A_JOIN =
NATURALINNERJOIN
( SELECTCOLUMNS(Tab_B,
"Code", Tab_B[Code]&"",
"Expected value", Tab_B[exp_value]+0 ),
SELECTCOLUMNS(Tab_A,
"Code", Tab_A[Code]&"",
"Observed value", Tab_A[obs_value]+0 )
)

but it has returned 6 rows and not 2 ones.
With an integer column as a matching column, the above dax expression functions with success!

I think to use a whatever transformation to obtain a numeric value from the text column, but I don't know a such dax function.

Other suggests to me in order to solve this issue, please? Thanks 🙂

1 ACCEPTED SOLUTION
dedelman_clng
Community Champion
Community Champion

Hi @Anonymous -

 

I cannot replicate your results. Perhaps I don't have the correct data in Tab_A and Tab_B?

 

Tab_A

Codeobs_value

aaaa 1
bbbb 2

 

Tab_B

Codeexp_value

aaaa 3
bbbb 4
cccc 5

 

TAB_B_A_JOIN (copied your code directly from the post)

CodeExpected valueObserved value

aaaa 3 1
bbbb 4 2

 

If that is not the correct source data, please clarify.  Perhaps there are relationships you're not aware of that may be affecting your results?

 

Hope this helps

David

View solution in original post

2 REPLIES 2
dedelman_clng
Community Champion
Community Champion

Hi @Anonymous -

 

I cannot replicate your results. Perhaps I don't have the correct data in Tab_A and Tab_B?

 

Tab_A

Codeobs_value

aaaa 1
bbbb 2

 

Tab_B

Codeexp_value

aaaa 3
bbbb 4
cccc 5

 

TAB_B_A_JOIN (copied your code directly from the post)

CodeExpected valueObserved value

aaaa 3 1
bbbb 4 2

 

If that is not the correct source data, please clarify.  Perhaps there are relationships you're not aware of that may be affecting your results?

 

Hope this helps

David

Anonymous
Not applicable

Hi, thanks for your reply.

I've discovered some errors in data for Tab_A and Tab_B, sorry.

It seems that the NATURALINNERJOIN functions rightly as you have indicated.

Many thanks and bye

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.