0

How do I use the sum in Cognos report studio for the Final Policy Premium?

Table 1 is the result (highlighted in Blue) that I currently get even if I set the Data Item (Final Policy Premium) into Total. My goal is to see the results as shown in Table 2 (highlighted in yellow).

Note: I removed the other columns as I think it is not needed to support my question. The columns removed were the ones you see in my query.

enter image description here

enter image description here

Select 
a.[Policy Number],
b.[Final Policy Premium],
a.[GWP Amt],     
a.[Transaction Type Code], 
a.[Insured], 
a.[Cancellation Effective Date],
a.[Transaction Date] as [Modified Date], 
a.[Cancellation Type Code],
a.[Cancellation Reason Code],
a.[Policy Transaction Type Code] 
from DW.Table a

inner join 
(Select SUM([GWP Amt]) as [Final Policy Premium],    
[Policy Number] from DW.Table
where [Policy Number] in ('1111111', '2222222')
group by [Policy Number]) b
on a.[Policy Number]=b.[Policy Number] 

where a.[Policy Number] in ('1111111', '2222222')
group by 
a.[Policy Number],
b.[Final Policy Premium],
a.[GWP Amt],      
a.[Transaction Type Code], 
a.[Insured], 
a.[Cancellation Effective Date],
a.[Transaction Date],
a.[Cancellation Type Code],
a.[Cancellation Reason Code],
a.[Policy Transaction Type Code] 
order by a.[Policy Number]
BongReyes
  • 205
  • 2
  • 7
  • 19

1 Answers1

1

I found the answer! Total([DW.Table].[GWP Amt] for [Policy Number]) inside the Data Item Expression Definition. Change the properties of the Data Item to Aggregate Function = Calculated.

BongReyes
  • 205
  • 2
  • 7
  • 19