Solved

SSRS - Ratio not calculating correctly

Posted on 2010-08-12
2
1,428 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction Earlier I wrote an article about the new lookup functions (http://www.experts-exchange.com/A_3433.html) that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

758 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

23 Experts available now in Live!

Get 1:1 Help Now