How To Merge These into One Report?

Thank you so much for your help with this! I ended up switching the code to the other dataset. I used this code and it works great!

="SELECT  T1.[JCDept2_Description], T1.[JobAsmbl2_AssemblySeq], T1.[JobAsmbl2_PartNum], T1.[Calculated_OpenJobQty], T1.[Calculated_OpenJobTarget], T1.[JobHead_Company], T1.[JobHead_JobNum]
, T2.[Calculated_Status], T2.[JCDept2_Description], T2.[JobAsmbl2_AssemblySeq], T2.[JobAsmbl2_PartNum], T2.[Calculated_MinOp], T2.[Calculated_OpenJobQty], T2.[Calculated_OpenJobValue], T2.[JobHead_Company], T2.[JobHead_Date08], T2.[JobHead_DueDate], T2.[JobHead_JobNum], T2.[JobHead_ReqDueDate], T2.[JobHead_StartDate], T2.[Calculated_Status], T2.[Calculated_MinOp], T2.[Calculated_OpenJobValue], T2.[JobHead_Date08], T2.[JobHead_DueDate], T2.[JobHead_ReqDueDate], T2.[JobHead_StartDate]
, T2.[JobOper4_DueDate], T2.[JobOper4_StartDate], T2.[JobOper5_DueDate], T2.[JobOper5_StartDate], T2.[Calculated_LastOpCompl]
 FROM OpenJobTargets_" + Parameters!TableGuid.Value + " AS T1 LEFT JOIN OpenJobValues_" + Parameters!TableGuid.Value + " AS T2 ON T1.[JobHead_Company] = T2.[JobHead_Company] AND T1.[JCDept2_Description] = T2.[JCDept2_Description] AND T1.[JobHead_JobNum] = T2.[JobHead_JobNum]"

A note to those copy/pasting any SQL code like this: The line breaks disappear running some line together. This causes a syntax error. Just make sure you have space between everything that needs a space. Thanks again John!

I thought I was on the right track here, but I missed something.

I have 2 BAQs each has the department, and a list of jobs with values. Not necessarily all the same jobs/asms/ops in both BAQs.

I want to match the department level subtotals in BAQ1 to the department level subtotals in BAQ2. My original work joined based on company, dept, and job. If I remove the job level link, then the report blows up returning way too many records.

How can I have this datasource return only the subtotals by department from one BAQ, and then figure the subtotals from the other BAQ, and just post those based on the department link?

I keep thinking I am going to have to setup a distinct query to return just the subtotals so that I have something to join on. Am I right?
Thanks again!

Is it a situation like the below? Where one baq may not have a department but it is in the other baq?

Dept     BAQ1     BAQ2
1        10
2                 12
3        7        11

Yes, even more than that, one BAQ might have a job but it could be missing in the other. Based on this revelation. I just made two more queries that summarize the data by department, and I used all four BAQs as the data sources for my report. it seems to be working now! :slight_smile: