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
Solved

Report Builder 3.0 Expression to calculate total "Outstanding" based on specific "Status"

Posted on 2016-10-31
3
57 Views
Last Modified: 2016-11-02
Hi,

I have a matrix report where the columns are grouped on the 'Status' field. There are 3 statuses in my data, Recalled, Returned and Transferred. I have added an expression in the "Outstanding" column to calculate the total in the "Requested" column MINUS the count in the "Status" column. I want the "Outstanding" column to calculate only the number of "Transferred". Currently the Outstanding column only take the requested number from whichever status is in the last column of the matrix. This is fine when the status is sorted A to Z, however I have been asked to show the "Transferred" in the first column. The image shows the matrix design, followed by how the 'Outstanding' is calculated off the "Transferred" when it is is the last column. The 3rd image shows how the "Outstanding" is now calculating off the 'Recalled' status, as it is the last column. I am trying to work out an expression that will show 'Requested MINUS Status' ONLY when the status is "Transferred", no matter which sort order is used.

Matrix design followed by output sorting A-Z and Z-A
Thanks in advance for any assistance you can give Experts!!

Lloyd
0
Comment
Question by:lawright17
3 Comments
 
LVL 28

Expert Comment

by:Pawan Kumar
ID: 41867910
Can you provide the expression ?
0
 
LVL 14

Accepted Solution

by:
Megan Brooks earned 500 total points
ID: 41867912
The simplest general solution I can think of is to add an integer calculated field to the dataset that has the value of the 'status' count if the status is 'transferred' and zero otherwise. When you sum the value of this new field over all the status column values in one row of report output, the result will be the the 'Transferred' value only.

Calculated field expression (call it 'TransferredOnly' or whatever you'd like):
=IIf(<test for status = transferred>, Fields!<status value field name>.Value, 0)
'Outstanding' column expression:
=Fields!<requested value field name>.Value - SUM(Fields!TransferredOnly.Value)
This will find the result no matter where 'Transferred' appears, if it appears at all, or even if it occurs more than once in a row (although I assume that it won't).
0
 

Author Closing Comment

by:lawright17
ID: 41871197
Thanks so much Megan! That has got my report showing exactly how we want it!
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSRS Reports - get rid of blank columns 3 72
SSRS Expression IIF Statements 2 58
SSRS ReportViewer report timeout 7 130
Learning SQL Reporting Services 2014 1 39
Written by Valentino Vranken. Introduction: The first step of creating a SQL Server Reporting Services (SSRS) report involves setting up a connection to the data source and programming a dataset to retrieve data from that data source.  The data…
Written by Valentino Vranken. Introduction: In a previous article (http://www.experts-exchange.com/articles/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Reporting-On-Data-From-Stored-Procedures-part-1.html) I announced that I would writ…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

829 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