Solved

SSRS - Ratio not calculating correctly

Posted on 2010-08-12
2
1,439 Views
Last Modified: 2012-06-21
I have a drilldown report and Group results for ELA/MHG are not calculating RATIO separately....  Any idea what I am doing wrong?

Ratio=Sum(Fields!ccSTA_MED.Value, "ReportDB")/(Sum(Fields!ccSTA_MED.Value, "ReportDB")+Sum(Fields!ccSTA_TELE.Value, "ReportDB")+Sum(Fields!ccSTA_ICU.Value, "ReportDB"))

Attached is an Excel Sample of SSRS report.

 Report2.xls
0
Comment
Question by:epicazo
2 Comments
 
LVL 21

Expert Comment

by:Alfred1
ID: 33426542
It is possible that you might be missing a group if you have nested groupings (parent/child groupings) since you mentioned that you have a drilldown report.  
For example if you have four groups nested in hierarchical fashion (e.g.  Group1 -> Group2 -> Group3 -> Group4) and by chance your columns only accommodate three groups (e.g. Group1 -> Group2 -> Group4) for example, then the values would be different and your result would not calculate correctly.


Also, based on your Excel Spreadsheet, you need to provide a condition in your expression (e.g. using IIF) to determine if the values in the row are ELA or MHG in order to calculate the correct ratio for each row.  It looks like your aggregate functions is aggregating for both ELA and MHG.
0
 

Accepted Solution

by:
epicazo earned 0 total points
ID: 33433440
I really wouldn't want to put an iff condition, then otherwise it wouldn't be dynamically calculating groups.  I figured out the problem.   There I was using the "ReportDB"

Sum(Fields!ccSTA_MED.Value, "ReportDB")/(Sum(Fields!ccSTA_MED.Value, "ReportDB")+Sum(Fields!ccSTA_TELE.Value, "ReportDB")+Sum(Fields!ccSTA_ICU.Value, "ReportDB"))

This solved the problem...
Sum(Fields!ccSTA_MED.Value)/(Sum(Fields!ccSTA_MED.Value)+Sum(Fields!ccSTA_TELE.Value)+Sum(Fields!ccSTA_ICU.Value))

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server Deadlocks 12 50
T-SQL:  Negative Numbering in CTE Is Not Working 2 29
Query / Window function ? 3 18
How do I Start SQL Management Studio 2012 17 20
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now