7 Replies Latest reply on Jun 29, 2018 1:17 PM by Deepak Rai

# Sum Calculation from Multiple Data Sources

I am working on a large workbook that contains multiple data sources.  One data source contains the net student contribution to the university by year, one shows the number of credit hours each student has taken a year, and one shows the courses available for a year.  I have a calculation that divides the student net contribution by year and divides that by the number of credit hours taken.  This calculation works great as long as I have the student ID number in my view.  I tried to add this calculation to a worksheet displaying student contribution per course (this worksheet lists course instead of student ID number).  I added my calculation to the sheet and instead of summing the results, it seems to be giving me an average (i.e. it shows 325 when it should be showing 7869).  When I try to do an LOD calculation, Tableau tells me it can't do that with information from two different data sources.  When I try to simply sum the calculation, Tableau tells me that the calculation is already an aggregate and cannot be further aggregated.  Is there a way to get it to sum this calculation by course?

The calculation for student contribution by credit hour is -- SUM([IND_STUDENT_CONTRIBUTION].[STUDENT_NET_CONTRIBUTION])/SUM([YR_CREDIT_HRS]).  I just want this number to summarize by course.  So, for example, if 5 students took a course that was 3 credit hours, student 1 paid \$10 per credit hour, student 2 paid \$15 per credit hour, student 3 paid \$5 per credit hour, student 4 paid \$10 per credit hour, and student 5 paid \$20 per credit hour -- the number I want to see is \$180 (each dollar amount times 3 and added together).

Is there a way to accomplish this?

Any assistance you can provide would be greatly appreciated.

• ###### 1. Re: Sum Calculation from Multiple Data Sources

Hi Diane,

Do you have some fake data set. and your requirement in simple 2 lines. Remember please, A detailed Description would not attract many helpers as human mind gets lost  after a while,reading something big.

Thanks

Deepak

• ###### 2. Re: Sum Calculation from Multiple Data Sources

Hi Deepak,

Attached is some fake data for one course.  I apologize, I thought the more detail I could give would be better. The columns highlighted are what I'm trying to achieve.

• ###### 3. Re: Sum Calculation from Multiple Data Sources

Try This Calc:

{FIXED Crs Cde,Id Num:SUM(Student  Net Contri)}/{FIXED Crs Cde,Id Num:SUM(Yr Credit Hrs)}

• ###### 4. Re: Sum Calculation from Multiple Data Sources

When I try that calculation, I am getting the below error message.  My Student Net Contribution is from a separate data source than the Yr Credit Hrs.

• ###### 5. Re: Sum Calculation from Multiple Data Sources

Can you join them? It will make your life easy. Otherwise do calculations separately and bring them together using ATTR. I can help you if you have a workbook, a simple one would suffice.

1 of 1 people found this helpful
• ###### 6. Re: Sum Calculation from Multiple Data Sources

I was able to join my two data sources using a custom query and I also used the ATTR you suggested.  It works now.  Thank you so much for your help.

• ###### 7. Re: Sum Calculation from Multiple Data Sources