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
briantam
Regular Visitor

Different result for the calculation field between many to many tables

Hi,

 I set the relationship between three tables.

 SalesOrder -> SalesOrderNo. = SalesOrderDetails -> SalesOrderNo.    (Many to one)
SalesOrderDetails -> SalesOrderNo. = SalesInvoiceSODetails -> SalesOrderNo.    (Many to Many)
SalesOrderDetails -> ItemCode = SalesInvoiceSODetails -> ItemCode    (Many to Many)
SalesOrderDetails -> SeqNo = SalesInvoiceSODetails -> SOSeqNo    (Many to Many)

Example 1  : Originally the Sales Order only included four items. When I select “Sum” for the "InvQty". The total transaction has still been 4  lines

Remark :  The field “InvQty” located in the table of  “SalesInvoiceSODetails”

Error1.png


Example 2 :  The same Sales Order, now I select “Don’t summarize” for the "InvQty". The total transaction up to 16   lines. Actually this only has 4  lines. So can you know how to fix it ?

Error2.png
Thanks!
Brian  

 

 

 

 

 

 

 

 

 

2 ACCEPTED SOLUTIONS
AllisonKennedy
Super User
Super User

Hi @briantam 

 

Thanks for the helpful info. 

A few things I noticed about your data model:

First, you can only have 1 active relationship between any two tables, so of those SalesOrderNo, ItemCod and SeqNo, two of them will be dotted lines and only the one solid line is working.

Second, you should only use Many to Many relationship if you absolutely need to and fully understand what you're doing. 

 

What you need to do is create a unique single column identifier of these columns and use that for the 1 relationship, that will hopefully be 1 to many.

You can do this in the Query Editor by clicking Transform Data in the home tab.

In the SalesOrderDetails query, use the Ctrl key to select SalesOrderNo, ItemCod and SeqNo columns, and in the Add Column tab merge the columns. 

Repeat the same merge columns in the SalesInvoiceSODetails query. 

Close and apply.

 

Delete all your old relationships between SalesOrderDetails and SalesInvoiceSODetails and create a Many to one relationship between these two tables instead. 

 

That should already solve your problem. 

 

Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 

 

If you found this post helpful, please give Kudos.

I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query. 

https://sites.google.com/site/allisonkennedycv


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

Hi AllisonKennedy

 

The problem already solved and thanks!

View solution in original post

3 REPLIES 3
AllisonKennedy
Super User
Super User

Hi @briantam 

 

Thanks for the helpful info. 

A few things I noticed about your data model:

First, you can only have 1 active relationship between any two tables, so of those SalesOrderNo, ItemCod and SeqNo, two of them will be dotted lines and only the one solid line is working.

Second, you should only use Many to Many relationship if you absolutely need to and fully understand what you're doing. 

 

What you need to do is create a unique single column identifier of these columns and use that for the 1 relationship, that will hopefully be 1 to many.

You can do this in the Query Editor by clicking Transform Data in the home tab.

In the SalesOrderDetails query, use the Ctrl key to select SalesOrderNo, ItemCod and SeqNo columns, and in the Add Column tab merge the columns. 

Repeat the same merge columns in the SalesInvoiceSODetails query. 

Close and apply.

 

Delete all your old relationships between SalesOrderDetails and SalesInvoiceSODetails and create a Many to one relationship between these two tables instead. 

 

That should already solve your problem. 

 

Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 

 

If you found this post helpful, please give Kudos.

I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query. 

https://sites.google.com/site/allisonkennedycv


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Hi AllisonKennedy

 

The problem already solved and thanks!

amitchandak
Super User
Super User

@briantam , Not sure why there two many many to Many relationships

 Refer how can you work with them

https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-many-to-many-relationships

https://www.seerinteractive.com/blog/join-many-many-power-bi/

https://radacad.com/many-to-one-or-many-to-many-the-cardinality-of-power-bi-relationship-demystified

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.