Suming two Columns from Different Tables - With Same Column Name

Mavericks334

Active Member
Joined
Jan 26, 2011
Messages
280
Hi,

I have Different Tables, 1. Voluntary Attrition. 2 InVoluntary Attrition. 3 Business Units

Each had dept ID' Column, Month Column. Below table is one for Voluntary Attrition.

[TABLE="width: 242"]
<COLGROUP><COL style="WIDTH: 50pt; mso-width-source: userset; mso-width-alt: 2450" width=67><COL style="WIDTH: 48pt" span=4 width=64><TBODY>[TR]
[TD="class: xl65, width: 67"]Dept Id[/TD]
[TD="class: xl66, width: 64"]Oct'09[/TD]
[TD="class: xl66, width: 64"]Nov'09[/TD]
[TD="class: xl66, width: 64"]Dec'09[/TD]
[TD="class: xl66, width: 64"]Jan'10[/TD]
[/TR]
[TR]
[TD="class: xl67"]3310ED[/TD]
[TD="class: xl69, align: right"]1[/TD]
[TD="class: xl69"] [/TD]
[TD="class: xl69, align: right"]1[/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl68, bgcolor: transparent"]3310FL[/TD]
[TD="class: xl69, bgcolor: transparent"] [/TD]
[TD="class: xl69, bgcolor: transparent"] [/TD]
[TD="class: xl69, bgcolor: transparent"] [/TD]
[TD="class: xl69, bgcolor: transparent, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl67"]3310HD[/TD]
[TD="class: xl69"] [/TD]
[TD="class: xl69"] [/TD]
[TD="class: xl69"] [/TD]
[TD="class: xl69"] [/TD]
[/TR]
[TR]
[TD="class: xl68, bgcolor: transparent"]3310PZ[/TD]
[TD="class: xl69, bgcolor: transparent"] [/TD]
[TD="class: xl69, bgcolor: transparent"] [/TD]
[TD="class: xl69, bgcolor: transparent"] [/TD]
[TD="class: xl69, bgcolor: transparent"] [/TD]
[/TR]
</TBODY>[/TABLE]


Similar table for involuntary attrition. I need to combine the both the Tables and get a consolidated number according to the month and Dept Id.

Regards,
Renato.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi,

I have Different Tables, 1. Voluntary Attrition. 2 InVoluntary Attrition. 3 Business Units

Each had dept ID' Column, Month Column. Below table is one for Voluntary Attrition.

[TABLE="width: 242"]
<TBODY>[TR]
[TD="class: xl65, width: 67"]Dept Id
[/TD]
[TD="class: xl66, width: 64"]Oct'09
[/TD]
[TD="class: xl66, width: 64"]Nov'09
[/TD]
[TD="class: xl66, width: 64"]Dec'09
[/TD]
[TD="class: xl66, width: 64"]Jan'10
[/TD]
[/TR]
[TR]
[TD="class: xl67"]3310ED
[/TD]
[TD="class: xl69, align: right"]1
[/TD]
[TD="class: xl69"][/TD]
[TD="class: xl69, align: right"]1
[/TD]
[TD="class: xl69"][/TD]
[/TR]
[TR]
[TD="class: xl68, bgcolor: transparent"]3310FL
[/TD]
[TD="class: xl69, bgcolor: transparent"][/TD]
[TD="class: xl69, bgcolor: transparent"][/TD]
[TD="class: xl69, bgcolor: transparent"][/TD]
[TD="class: xl69, bgcolor: transparent, align: right"]1
[/TD]
[/TR]
[TR]
[TD="class: xl67"]3310HD
[/TD]
[TD="class: xl69"][/TD]
[TD="class: xl69"][/TD]
[TD="class: xl69"][/TD]
[TD="class: xl69"][/TD]
[/TR]
[TR]
[TD="class: xl68, bgcolor: transparent"]3310PZ
[/TD]
[TD="class: xl69, bgcolor: transparent"][/TD]
[TD="class: xl69, bgcolor: transparent"][/TD]
[TD="class: xl69, bgcolor: transparent"][/TD]
[TD="class: xl69, bgcolor: transparent"][/TD]
[/TR]
</TBODY>[/TABLE]


Similar table for involuntary attrition. I need to combine the both the Tables and get a consolidated number according to the month and Dept Id.

Regards,
Renato.

Are your data in the same Sheet? On a different one?If the latest are they on the same position on each tab?
 
Upvote 0
in a different sheet and and the latest are on the same position of each tab

Try this assuming that the heading in both sheets are in the same position:

Excel 2010
ABCDE
1Dept IdOct'09Nov'09Dec'09Jan'10
23310ED11
33310FL1
43310HD
53310PZ
Voluntary Attrition


Excel 2010
ABCDE
1Dept IdOct'09Nov'09Dec'09Jan'10
23310FL11
33310ED1
43310HD
53310PZ
InVoluntary Attrition


Excel 2010
ABCDEFGHI
1Oct'09Nov'09Dec'09Jan'10
23310ED1011Voluntary Attrition
33310FL1011InVoluntary Attrition
43310HD0000
53310PZ0000
Summary
Cell Formulas
RangeFormula
B2=SUMPRODUCT(SUMIF(INDIRECT("'"&list&"'!$a$2:$a$20"),$A2,INDIRECT("'"&list&"'!"&SUBSTITUTE(CELL("address",($A$1,B$2:B$20)),"$A$1,",""))))
Named Ranges
NameRefers ToCells
list=Summary!$I$2:$I$3


Copy formula down and accross
You can hide the 0 using Custom Format:

Right Click on the Cell--Format Cells-->Number-->Custom.
Under Type enter:
[=0]"";General
 
Upvote 0
Thanks Robert, this would work in the regular excel, i need this work in Powerpivot, i have the above formula already for regular excel, i am trying to use powerpivot to get the information which i would later compute monthly and 12 month moving average.
 
Upvote 0
Thanks Robert, this would work in the regular excel, i need this work in Powerpivot, i have the above formula already for regular excel, i am trying to use powerpivot to get the information which i would later compute monthly and 12 month moving average.


Aplogize maverick.

I have posted in wrong forum.
Hope someone else will help you
 
Upvote 0
Hi I tried the below DAX mesure to calculate the two columns
=IF(HASONEFILTER(BU[Dept Id]),CALCULATE(VALUES(TERM[Oct 11]),BU)&CALCULATE(VALUES(XOFT[Oct 11]),BU))

I am able to add the columns accordingly however my problem is that if i have more than 12 columns in each table i need to write 12 such measures. I need to create something dynamic that would automatically calculate the respective columns accordingly. Also

When i create the pivot to get the data it only gives me by the id not the name of the dept even after created a relationship between these tables.
 
Upvote 0
You have not really asked a question, but I assume you want to know how you can work with these data in PowerPivot.

My answer: you cannot (at least not in a meaningful way).

You will have to import them in a correct format {Dept ID, Month, First Day Of Month}
 
Upvote 0
Hi Laurent,

My question is how do i combine two columns where they have the same name in from different table. The above format is how my data comes every month. The Dept id and the current month as the column name, i need to combine both these tables together and then i would use it to get a moving average for 12 months.
So each month {Dept Id Oct Nov Dec} so on would be added to get the data.

I tried to use the data in three columns dept id Month and Attrition, how ever it does not work because i am unable to create a relation ship between both these tables. Hopeful this could be done with a DAX, otherwise would need MDX to see if it would work.
 
Upvote 0
My advice to you is to transform this data in a PowerPivot-friendly format, and make sure your table has a column for Dept ID, one for the month, and one for your metric.

You can do this when you import your data every month, either with VBA, or SQL, or Excel formulas, ...

I also suggested you add a column with the first day of the month, so you could link your data to your Date table. Also link the Dept ID to the appropriate table, and from there on, it should be easy to do your DAX expressions.
 
Upvote 0

Forum statistics

Threads
1,223,931
Messages
6,175,465
Members
452,645
Latest member
Tante

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top