?
Solved

Calculate total and percentage columns from ssrs 2008 r2 dataset for reports.

Posted on 2011-09-05
7
Medium Priority
?
3,139 Views
Last Modified: 2012-06-21
Hi,

I have a situation to calculate the total of a column in dataset in ssrs 2008 r2 to calculate percentage in another column.

e.g.,

ValueColumn       TotalColumn        PercentageColumn
20                            69                      20/69*100
33                            69                      33/69*100
46                            69                      46/69*100


I want to create TotalColumn and Percentage from SSRS 2008 R2 dataset (using calculated field or some other method not sure!!!!!!!!!!!)

Your help and  suggesionss are highly appreciated.

Thanks.

0
Comment
Question by:ezkhan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 24

Expert Comment

by:mankowitz
ID: 36485741
what does the raw sql query look like? What is the table structure? Is TotalColumn a calculated field, or is it something directly from the DB?

You might be able to do this:

SELECT ValueColumn, TotalColumn, ValueColumn/TotalColumn*100 AS PercentageColumn FROM DataTable
0
 

Author Comment

by:ezkhan
ID: 36485815


I can do it in db but these columns are not individual columns e.g.,

As per your select statment ValueColumn is derived from number of aggregagetes and divisions with 10 different columns in database dataset. If I calculate percentage again in database then i need to calculate ValueColumn twice and there more than one columns where i need to calculate percentage. It slows down the whole query and increases CPU usage.

Thats why I want to calculate percentage from already calculated columns in Reporting Services instead of DB.

Please suggest solution in reporting services. Your answers and suggestions are greatly appreciated.

Thanks
0
 
LVL 22

Expert Comment

by:Thomasian
ID: 36486349
TotalColumn:
=Sum(Fields!ValueColumn.Value, "DataSetName")

Open in new window

PercentageColumn:
=Fields!ValueColumn.Value/Sum(Fields!ValueColumn.Value, "DataSetName")*100

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:mimran18
ID: 36486574
try this

 
=Sum(Fields!FieldName.Value,"DatasetName")

Open in new window

=Round((Fields!SrNo.Value/SUM(Fields!FieldName.Value,"Dataset")*100),2)

Open in new window

0
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 36486780
0
 

Author Comment

by:ezkhan
ID: 36491180



Thanks a lot for your suggesions; I want to use this calculated percentage column in pie chart as series!!!!!!!!!

Is this possible???????????
0
 
LVL 22

Accepted Solution

by:
Thomasian earned 2000 total points
ID: 36493062
If you want to use it on a pie chart, you don't need to calculate the percentage manually. Just drop the ValueColumn on the data field and it will automatically divide the chart as percentage. If you want to show the percentage as label, then you could select #PERCENT as the Label Data.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

765 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