Currently we are not using Variable to calculate SUM. The SQL Query is designed to pull all the column values and calculate the Sum of column values that satisfy a condition. We are just mapping the Fields to the Report Columns and Total Row. The issue occurs only when there report is generated for more than 1 id. Summation is handled in the Query below. Select object_id, case when type_of_benefit='Hard' then to_char(round(nvl(sum(q1_plan_hours),0)/1000000,3),'$9,999,999,990.999')||'M' else to_char(round(nvl(sum(q1_plan_hours),0),3)) end q1_plan_hours, case when type_of_benefit='Hard' then to_char(round(nvl(sum(q2_plan_hours),0)/1000000,3),'$9,999,999,990.999')||'M' else to_char(round(nvl(sum(q2_plan_hours),0),3)) end q2_plan_hours, case when type_of_benefit='Hard' then to_char(round(nvl(sum(q3_plan_hours),0)/1000000,3),'$9,999,999,990.999')||'M' else to_char(round(nvl(sum(q3_plan_hours),0),3)) end q3_plan_hours, case when type_of_benefit='Hard' then to_char(round(nvl(sum(q4_plan_hours),0)/1000000,3),'$9,999,999,990.999')||'M' else to_char(round(nvl(sum(q4_plan_hours),0),3)) end q4_plan_hours, case when type_of_benefit='Soft' then (case when lower(soft_benefit_class)='number' then to_char(round(nvl(sum(q1_plan_hours),0),2)+round(nvl(sum(q2_plan_hours),0),2)+round(nvl(sum(q3_plan_hours),0),2)+round(nvl(sum(q4_plan_hours),0),2)) else null end ) else to_char(round(nvl(sum(q1_plan_hours),0)/1000000,3)+round(nvl(sum(q2_plan_hours),0)/1000000,3)+round(nvl(sum(q3_plan_hours),0)/1000000,3)+round(nvl(sum(q4_plan_hours),0)/1000000,3),'$9,999,999,990.999')||'M' end annual_total_plan_hours, case when type_of_benefit='Soft' then (case when lower(soft_benefit_class)='number' then to_char(sum(round(nvl(sum(q1_plan_hours),0),2)) over (partition by object_id,type_of_benefit,soft_benefit_class)) else null end ) else to_char(sum(round(nvl(sum(q1_plan_hours),0)/1000000,3)) over (partition by object_id,type_of_benefit),'$9,999,999,990.999')||'M' end q1_total_plan_hours, case when type_of_benefit='Soft' then (case when lower(soft_benefit_class)='number' then to_char(sum(round(nvl(sum(q2_plan_hours),0),2)) over (partition by object_id,type_of_benefit,soft_benefit_class)) else null end ) else to_char(sum(round(nvl(sum(q2_plan_hours),0)/1000000,3)) over (partition by object_id,type_of_benefit),'$9,999,999,990.999')||'M' end q2_total_plan_hours, case when type_of_benefit='Soft' then (case when lower(soft_benefit_class)='number' then to_char(sum(round(nvl(sum(q3_plan_hours),0),2)) over (partition by object_id,type_of_benefit,soft_benefit_class)) else null end ) else to_char(sum(round(nvl(sum(q3_plan_hours),0)/1000000,3)) over (partition by object_id,type_of_benefit),'$9,999,999,990.999')||'M' end q3_total_plan_hours, case when type_of_benefit='Soft' then (case when lower(soft_benefit_class)='number' then to_char(sum(round(nvl(sum(q4_plan_hours),0),2)) over (partition by object_id,type_of_benefit,soft_benefit_class)) else null end ) else to_char(sum(round(nvl(sum(q4_plan_hours),0)/1000000,3)) over (partition by object_id,type_of_benefit),'$9,999,999,990.999')||'M' end q4_total_plan_hours, case when type_of_benefit='Soft' then (case when lower(soft_benefit_class)='number' then to_char(sum(round(nvl(sum(q1_plan_hours),0),2)+round(nvl(sum(q2_plan_hours),0),2)+round(nvl(sum(q3_plan_hours),0),2)+round(nvl(sum(q4_plan_hours),0),2)) over (partition by object_id,type_of_benefit,soft_benefit_class)) else null end ) else to_char(sum(round(nvl(sum(q1_plan_hours),0)/1000000,3)+round(nvl(sum(q2_plan_hours),0)/1000000,3)+round(nvl(sum(q3_plan_hours),0)/1000000,3)+round(nvl(sum(q4_plan_hours),0)/1000000,3)) over (partition by object_id,type_of_benefit),'$9,999,999,990.999')||'M' end annual_t_plan_hours, case when type_of_benefit='Hard' then to_char(round(nvl(sum(q1_actual_hours),0)/1000000,3),'$9,999,999,990.999')||'M' else to_char(round(nvl(sum(q1_actual_hours),0),3)) end q1_actual_hours, case when type_of_benefit='Hard' then to_char(round(nvl(sum(q2_actual_hours),0)/1000000,3),'$9,999,999,990.999')||'M' else to_char(round(nvl(sum(q2_actual_hours),0),2)) end q2_actual_hours, case when type_of_benefit='Hard' then to_char(round(nvl(sum(q3_actual_hours),0)/1000000,3),'$9,999,999,990.999')||'M' else to_char(round(nvl(sum(q3_actual_hours),0),3)) end q3_actual_hours, case when type_of_benefit='Hard' then to_char(round(nvl(sum(q4_actual_hours),0)/1000000,3),'$9,999,999,990.999')||'M' else to_char(round(nvl(sum(q4_actual_hours),0),3)) end q4_actual_hours, case when type_of_benefit='Soft' then (case when lower(soft_benefit_class)='number' then to_char(round(nvl(sum(q1_actual_hours),0),2)+round(nvl(sum(q2_actual_hours),0),2)+round(nvl(sum(q3_actual_hours),0),2)+round(nvl(sum(q4_actual_hours),0),2)) else null end ) else to_char(round(nvl(sum(q1_actual_hours),0)/1000000,3)+round(nvl(sum(q2_actual_hours),0)/1000000,3)+round(nvl(sum(q3_actual_hours),0)/1000000,3)+round(nvl(sum(q4_actual_hours),0)/1000000,3),'$9,999,999,990.999')||'M' end annual_total_actual_hours, case when type_of_benefit='Soft' then (case when lower(soft_benefit_class)='number' then to_char(sum(round(nvl(sum(q1_actual_hours),0),2)) over (partition by object_id,type_of_benefit,soft_benefit_class)) else null end ) else to_char(sum(round(nvl(sum(q1_actual_hours),0)/1000000,3)) over (partition by object_id,type_of_benefit),'$9,999,999,990.999')||'M' end q1_total_actual_hours, case when type_of_benefit='Soft' then (case when lower(soft_benefit_class)='number' then to_char(sum(round(nvl(sum(q2_actual_hours),0),2)) over (partition by object_id,type_of_benefit,soft_benefit_class)) else null end ) else to_char(sum(round(nvl(sum(q2_actual_hours),0)/1000000,3)) over (partition by object_id,type_of_benefit),'$9,999,999,990.999')||'M' end q2_total_actual_hours, case when type_of_benefit='Soft' then (case when lower(soft_benefit_class)='number' then to_char(sum(round(nvl(sum(q3_actual_hours),0),2)) over (partition by object_id,type_of_benefit,soft_benefit_class)) else null end ) else to_char(sum(round(nvl(sum(q3_actual_hours),0)/1000000,3)) over (partition by object_id,type_of_benefit),'$9,999,999,990.999')||'M' end q3_total_actual_hours, case when type_of_benefit='Soft' then (case when lower(soft_benefit_class)='number' then to_char(sum(round(nvl(sum(q4_actual_hours),0),2)) over (partition by object_id,type_of_benefit,soft_benefit_class)) else null end ) else to_char(sum(round(nvl(sum(q4_actual_hours),0)/1000000,3)) over (partition by object_id,type_of_benefit),'$9,999,999,990.999')||'M' end q4_total_actual_hours, case when type_of_benefit='Soft' then (case when lower(soft_benefit_class)='number' then to_char(sum(round(nvl(sum(q1_actual_hours),0),2)+round(nvl(sum(q2_actual_hours),0),2)+round(nvl(sum(q3_actual_hours),0),2)+round(nvl(sum(q4_actual_hours),0),2)) over (partition by object_id,type_of_benefit,soft_benefit_class)) else null end ) else to_char(sum(round(nvl(sum(q1_actual_hours),0)/1000000,3)+round(nvl(sum(q2_actual_hours),0)/1000000,3)+round(nvl(sum(q3_actual_hours),0)/1000000,3)+round(nvl(sum(q4_actual_hours),0)/1000000,3)) over (partition by object_id,type_of_benefit),'$9,999,999,990.999')||'M' end annual_t_act_hours from Table_Name group by object_id, type_of_benefit, soft_benefit_class order by object_id, type_of_benefit Please see below the group expression from the jrxml. <group name="Project" isStartNewPage="true"> <groupExpression><![CDATA[$F{OBJECT_ID}]]></groupExpression> <groupHeader> <band height="77"> <textField> <textFieldExpression><![CDATA["Type of Benefit"]]></textFieldExpression> </textField> </band> </groupHeader> <groupFooter> <band> <property name="com.jaspersoft.studio.unit.height" value="px"/> </band> </groupFooter> </group> <group name="Benefit Type"> <groupExpression><![CDATA[$F{TYPE_OF_BENEFIT}]]></groupExpression> <groupHeader> <band> <property name="com.jaspersoft.studio.unit.height" value="px"/> </band> </groupHeader> <groupFooter> <band height="40"> <property name="com.jaspersoft.studio.unit.height" value="px"/> <printWhenExpression><![CDATA[$F{TYPE_OF_BENEFIT}.equals("Hard")]]></printWhenExpression> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <textFieldExpression><![CDATA["Total Hard Benefit"]]></textFieldExpression> </textField> </textField> </band> <band height="40"> <property name="com.jaspersoft.studio.unit.height" value="px"/> <printWhenExpression><![CDATA[$F{TYPE_OF_BENEFIT}.equals("Soft")]]></printWhenExpression> <textFieldExpression><![CDATA["Total Soft Benefit Number"]]></textFieldExpression> </textField> </band> </groupFooter> <group name="Soft Benefit Class "> <groupExpression><![CDATA[$F{Soft_Benefit_Class}]]></groupExpression> <groupHeader> <band> <property name="com.jaspersoft.studio.unit.height" value="px"/> </band> </groupHeader> <groupFooter> <band> <property name="com.jaspersoft.studio.unit.height" value="px"/> </band> </groupFooter> </group> Attaching the sample Report output.