Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
I need to solve how to create measures between tables that have many to many relationships.
I’ll describe the process and data
I need these to be measures (System to Product to COST) and (Product COST) as we have other “attributes” on our people that we will use to filter, like Role and Location and as such want to see how they affect the rolled up numbers.
My challenge is around the Many to Many relationship of table A and table B. How can I create a measure to sum the person cost per each system and product. Table B will find the person cost records for each system and then multiply by the allocation to the product.
Below is a rough example of how our data is structured.
Solved! Go to Solution.
Hi @Anonymous
Here is a little pseudocode as a description:
For each row from [Table B], do the following expression
For each (related) row of the related [Table A], do the following expression
Personnel costs from [Table A] * Allocation from [Table B]
and then calculate the SUM
and then calculate the SUM
At first the allocated person cost of [Table A] ist calculated row by row (SUMX)
and then the SUM for [Table B] ist calculated row by row (SUMX) .
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials
Hi @Anonymous ,
You may download my PBIX file from here.
Hope this helps.
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials
Hi @Anonymous ,
next try PBIX
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials
Hi @Anonymous ,
The URL probably contained a problematic string
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials
Thanks @mwegener Appreciate the input/fedback...
I will review some more but ... I'm not sure off the top of my head that this will work.. You created a calculated column not a measure.
In my post I needed to do a "measure" so as to be able to use Attributes about people to "filter" the allocated Person Cost in the rollup to Product Costs...
Example, if we had a attribute called "role" on Table A for each persons record(s).. (Role 1, Role 2, Role 3, etc.. ) then we would want to see the cost by "ROLE" .. futher we might also have an attribute called "Location"...
Then the Cost at the Product Level could be broken down by Role and Location..
make sense?
Hi @Anonymous ,
take this...
M Allocate Person Cost = SUMX('Table B', SUMX(RELATEDTABLE('Table A'), 'Table A'[Person Cost] * 'Table B'[Allocat]))
If I answer you question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials
This appears to work, thanks a ton for your input/feedback.
.. as a "conclusion" and so as when others find this thread they can learn what is going on "under the covers";
could you "explain" how the nested Sumx functions are "working"..
M Allocate Person Cost = SUMX('Table B', SUMX(RELATEDTABLE('Table A'), 'Table A'[Person Cost] * 'Table B'[Allocat]))
Again thanks for your help!
Hi @Anonymous ,
has your question been answered?
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials
Hi @Anonymous
Here is a little pseudocode as a description:
For each row from [Table B], do the following expression
For each (related) row of the related [Table A], do the following expression
Personnel costs from [Table A] * Allocation from [Table B]
and then calculate the SUM
and then calculate the SUM
At first the allocated person cost of [Table A] ist calculated row by row (SUMX)
and then the SUM for [Table B] ist calculated row by row (SUMX) .
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 76 | |
| 38 | |
| 31 | |
| 27 | |
| 26 |