Solved

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

Posted on 2016-10-31
3
38 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 24

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Have you ever had to extract data from a Microsoft SQL Server database and export it to an Excel file, but did not want to use a DTS package? The concept in this article is not new, but it is the answer and will also work on 64-bit SQL boxes.   …
How to use Variables  and Custom code in SSRS report and Assembly reference to use compile shared code in SSRS. Its big question for all who are working with SSRS. It is easy to create assembly and refer in SSRS report, still there are some steps…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.

911 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

22 Experts available now in Live!

Get 1:1 Help Now