Results off in matrix report
Hi, I'm building a matrix report on MSSRS 2008 R2 and somehow I'm getting wrong results on my calculations. When I run my query and export those results to excel, I get the right results. However, as soon as I put my result set to build a matrix report, my totals are off by a couple of units. I thought it was the rounding off of figures that was at the root of the problem. So to avoid this, I made the round at the sql statement level to no avail. I checked the cell formatting, I took off the rounding there and no difference. This is my sql statement: SELECT CAMS_StudentStatus_View.StudentID, CAMS_StudentStatus_View.Term, CAMS_StudentStatus_View.TextTerm, CAMS_StudentStatus_View.EnrollmentStatus, CAMS_StudentStatus_View.CollegeLevel, CAMS_StudentStatus_View.StudentLoad, CAMS_StudentStatus_View.RegisterStatus, CAMS_StudentStatus_View.GPAGrouping, CAMS_StudentStatus_View.StudentUID, CAMS_StudentDemographics_View.Gender, CASE WHEN credits.credits < @FT_Hrs_par THEN credits.credits ELSE 0 END AS PTCrs, CASE WHEN (credits.credits BETWEEN @FT_Hrs_par AND @Overload_Hrs_par) THEN credits.credits ELSE 0 END AS FTCrs, CASE WHEN credits.credits > @Overload_Hrs_par THEN credits.credits ELSE 0 END AS OvrCrs, CASE WHEN (credits.credits BETWEEN @FT_Hrs_par AND @Overload_Hrs_par) THEN 1 ELSE 0 END AS FT_FTES, CASE WHEN credits.credits < @FT_Hrs_par THEN credits.credits / @FT_Hrs_par ELSE 0 END AS PT_FTES, CASE WHEN credits.credits > @Overload_Hrs_par THEN 1 + (credits.credits - @Overload_Hrs_par) / @FT_Hrs_par ELSE 0 END AS Ovr_FTES, CASE WHEN CAMS_StudentStatus_View.Term = LatestTermReg.LastTerm THEN 'Yes' ELSE 'No' END AS LastSem, Credits.credits AS Expr1 FROM CAMS_StudentStatus_View INNER JOIN (SELECT StudentUID, TermCalendarID, SUM(Credits) AS credits FROM CAMS_SRAcademic_View AS s WHERE (CategoryID <> (SELECT TOP (1) UniqueId FROM Glossary WHERE (DisplayText = 'Transfer') AND (Category = 1042))) GROUP BY StudentUID, TermCalendarID) AS Credits ON CAMS_StudentStatus_View.StudentUID = Credits.StudentUID AND CAMS_StudentStatus_View.TermCalendarID = Credits.TermCalendarID LEFT OUTER JOIN CAMS_StudentDemographics_View ON CAMS_StudentStatus_View.StudentUID = CAMS_StudentDemographics_View.StudentUID LEFT OUTER JOIN (SELECT StudentUID, MAX(TermSeq) AS LastTerm FROM CAMS_SRAcademic_View AS CAMS_SRAcademic_View_1 GROUP BY StudentUID) AS LatestTermReg ON CAMS_StudentStatus_View.StudentUID = LatestTermReg.StudentUID As you can see, I have no rounding here. My two cells causing problems have these calculations: =round(Sum(Fields!PTCrs.Value)/Parameters!FTE_par.Value,2) =Round(Sum(Fields!FT_FTES.Value)+Sum(Fields!Ovr_FTES.Value),2) When I export my query result to excel I get on for the first calculation 48.08 and for the second one 806.39 whereas on the matrix resport I get 48.38 and 809.08 accordingly. Any help in trying to solve this mystery is greatly appreciated. Best regards, MP
May 27th, 2011 9:20am

To diagnose this issue, I would first remove the formatting from the textboxes in the report and rounding from your expressions so you can see the true results of the calculations. It's possible that some implicit type conversion is going on in your expression. Double check the data type of the fields and parameters in question. In your expressions, explicitly cast each field and parameter reference to the correct data type. For example: =Sum(CDbl(Fields!PTCrs.Value))/CDbl(Parameters!FTE_par.Value) After you get to the bottom of the calculation logic error, re-apply the format. If possible, avoid explictly rounding after the calculation. You should be able to handle this by formatting rather than changing the value.Paul Turley, MVP, www.SQLServerBIBlog.com *Please vote if helpful*
Free Windows Admin Tool Kit Click here and download it now
May 31st, 2011 4:21am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics