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
Anonymous
Not applicable

SUM RELATED

Hello,

I have 2 tables with a many to many relationship. I need to sum the costs from table 1 but filter based on the other table.
The RELATED function doesnt work for me because of the many to many relation. How can I still realize to sum it?

Thanks in advance 

2 REPLIES 2
v-chenwuz-msft
Community Support
Community Support

Hi @Anonymous 

 

if you want to create a column, please try some dax expression like the following :

Column =
CALCULATE(
    SUM( 'Table (1)'[cost] ),
    FILTER( 'Table (2)', the filter conditions )
)

 

if you want calculate values in visual, you can just put the field from table 2 in the Filters and sum() function will keep the filter.

vchenwuzmsft_0-1637028043282.png

 

Best Regards

Community Support Team _ chenwu zhu

 

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

 

amitchandak
Super User
Super User

@Anonymous , You need to use relatedtable in sumx

new column in table 1 =

sumx(relatedtable(Table2), Table2[Value])

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

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
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.