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

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

Reply
Anonymous
Not applicable

Creating a new table with a column that is the elementwise sum of columns from two other tables

My question seems like a relatively simple one, but I haven't been able to find any answer on this forum that satisfies me.

 

Table A contains a column of company names and a column of values for the revenue generated by each company ("revenue").

 

Table B contains a column of company names (although the list is not identical to the list of company names in Table A; in fact, Table B's company names are a subset of Table A's) and a column of costs incurred by each company ("costs").

 

I would like to create a new table ("Table C") with a list of company names as its first column and (revenues - costs) as the second column. How would I do this?

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous the best approach here is to create a company dimension with unique list of companies, set relationship with this company table with you revenue and cost tables

 

Add following measures

 

Revenue = SUM(RevenueTable[Revenue])

Cost = SUM( CostTable[Cost] )

Diff = [Revenue] - [Cost]

add table visual, and put company from newly create company table, and all above measures.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

7 REPLIES 7
parry2k
Super User
Super User

@Anonymous the best approach here is to create a company dimension with unique list of companies, set relationship with this company table with you revenue and cost tables

 

Add following measures

 

Revenue = SUM(RevenueTable[Revenue])

Cost = SUM( CostTable[Cost] )

Diff = [Revenue] - [Cost]

add table visual, and put company from newly create company table, and all above measures.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

But would that generate a two-column table? I want my result to be something like the following:

 

Acme Industries, $31909;

Batteries Plus, $1672;

Cranmer and Associates, $8365;

...

 

Are measures really the way to achieve that?

@Anonymous yes, measure is the way to achieve it and you will able to get what you are expecting?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

I successfully made a master list of companies (with no blank entries or duplicates) in its own table.

 

I then created a one:many relationship from the master list onto Table A's company list, and a one:many relationship from the master list onto Table B's company list.

 

However, I am having trouble creating the final table along your specifications. I add the master list of company names, which of course works fine. However, when I go to write the formula to create the calculated difference column, it doesn't recognize "revenues" or "costs" as valid entries to perform column operations on. Is there something I'm missing?

 

Also, the SUM-function doesn't give me what I want. When I use it and then take the difference of the sums, I get the equivalent of:

 

Acme Industries, $50354;

Banner Corp., $50354;

Cranmer and Associates, $50354;

...

 

Which is obviously not very useful.

@Anonymous you have to add calculated Measure not Column.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Sorry for the misreading. I switched them from columns to measures like you said and, holy cow, it actually worked. It's exactly what I wanted. Thanks so much!

@Anonymous glad to hear. Enjoy!!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

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

Top Solution Authors
Top Kudoed Authors