In case anyone is looking for the answer, I figured it out as well as adding row totals. <pre><code> q = load "Opportunity_Campaign_Influence"; --Sum the ARR for each campaign type sub grouped by Probability mainData = group q by ('CampaignId.Type', 'Opp_Probability'); mainData = foreach mainData generate q.'CampaignId.Type' as 'Campaign', q.'Opp_Probability' as 'Probability', sum(q.'ARR_Share__c') as 'ARR'; --Add the row totals to each row of the main data table --Use group by rollup to get row totals as well as a grand total --relabel the grand total Campaign to TOTAL for matching with the union mainDataWithRowTotal = group mainData by rollup ('Campaign', 'Probability'); mainDataWithRowTotal = foreach mainDataWithRowTotal generate (case when grouping(mainData.'Campaign') == 1 then "TOTAL" else mainData.'Campaign' end ) as 'Campaign', (case when grouping(mainData.'Probability') == 1 then "Total" else mainData.'Probability' end ) as 'Probability', coalesce(sum(mainData.'ARR'), 4) as 'ARR'; --Calculate the total row, label the campaign TOTAL --So that it matches with the mainData in the Union totalRow = group mainData by ('Probability'); totalRow = foreach totalRow generate "TOTAL" as 'Campaign', mainData.'Probability' as 'Probability' , sum(mainData.'ARR') as 'ARR'; totalRow = group totalRow by ('Campaign', 'Probability'); totalRow = foreach totalRow generate 'Campaign' as 'Campaign', 'Probability' as 'Probability' , sum('ARR') as 'ARR'; result = union mainDataWithRowTotal,totalRow; result = limit result 2000; </code></pre>