Forum Discussion
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?
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.
7 Replies
- parry2kSuper 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.
- AnonymousNot 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?
- parry2kSuper User
Anonymous yes, measure is the way to achieve it and you will able to get what you are expecting?