The reason for this probably lies in my request, because I used MAX to collect a unique record. But now my SSRS report does not display the correct NetWrittenPremium amount. What will be the workaround for this problem?
Here is my request:
select b.YearNum, b.MonthNum, ClassCode, QLL.Description, SUM( Premium) as NetWrittenPremium FROM tblCalendar b LEFT JOIN ProductionReportMetrics prm ON b.MonthNum=Month(prm.EffectiveDate) AND b.YearNum = YEAR(EffectiveDate) AND prm.EffectiveDate >=DateAdd(yy, -1, DATEADD(d, 1, EOMONTH(GETDATE()))) AND prm.EffectiveDate <= EOMONTH(GETDATE()) AND CompanyLine = 'Ironshore Insurance Company' LEFT JOIN NetRate_Quote_Insur_Quote Q ON prm.NetRate_QuoteID = Q.QuoteID LEFT JOIN NetRate_Quote_Insur_Quote_Locat QL ON Q.QuoteID = QL.QuoteID LEFT JOIN (SELECT * FROM NetRate_Quote_Insur_Quote_Locat_Liabi nqI JOIN ( SELECT LocationID as LocID, MAX(ClassCode) as ClCode FROM NetRate_Quote_Insur_Quote_Locat_Liabi GROUP BY LocationID ) nqA ON nqA.LocID = nqI.LocationID AND nqA.ClCode = nqI.ClassCode ) QLL ON QLL.LocationID = QL.LocationID WHERE ( b.YearNum = YEAR(GETDATE())-1 and b.MonthNum >= MONTH(GETDATE())+1 ) OR ( b.YearNum = YEAR(GETDATE()) and b.MonthNum <= MONTH(GETDATE()) ) GROUP BY b.YearNum,b.MonthNum,ClassCode, QLL.Description
My tablix structure: I integrate in Description and ClassCode. Sort it using SUM(NetWrittenPremium) DESC and Filtering by SUM(NetWrittenPremium) TOP 10 . And another group is MonthNum. 

I added a new group with the group expression = 1 But all the same wrong totals 
Oleg
source share