Sum of Individual Parameters in an RDL File - mysql

I am building an rdl report and I want to find the sum of each parameter and the grand total . I have grouped as per the date and found the grand total,,, Is there anyhow i can find the total of each parameter ,,, like total of a1, a2, M1 here in this scenario,,, what would be the expression for that?
It was possible for me to find the Grand total by grouping on a date,,, i want to find the total of each parameter now.., like total of a1, a2, M1 here in this scenario,,, what would be the expression for that?
enter image description here

Related

SSRS - Percentage Totals Row

I am trying to build an SSRS report that has a column based on a percentage:
AgentSales AgentCommission Commission
20 .25 5
33 .12 3.96
46 .76 34.96
Totals: 99 [Unknown Calculation]
However, where I am having problems is I need to get what would be the totals column? How would I calculate the Commission so that the number shown in [Unknown Calculation] to display what I assume would be the average commission?
Commission column is simply AgentSales * AgentCommission. The total commission wouldn't be a SUM(Commission), but would more or less be the average commission for all agents.
Assuming you want to calculate the weighted average commission then I would calculate it like this..
Expression 1: is simple as per your sample.
=Fields!AgentSales.Value * Fields!AgentCommission.Value
Expression 2: is the sum of the results of expression 1
=SUM(Fields!AgentSales.Value * Fields!AgentCommission.Value)
Expression 3: is the expression 2 divided by the sum of agent sales
=(SUM(Fields!AgentSales.Value * Fields!AgentCommission.Value))
/
SUM(Fields!AgentSales.Value)
The other cells should be self explanatory...
When we run the report we get the following.
If this is not what you wanted, then please edit your question to show the desired result and how you arrived at that result.
EDIT AFTER UPDATE FROM OP
If you want the cell marked "2" in my sample to be an average of the values above then simpley change it to
=AVG(Fields!AgentSales.Value * Fields!AgentCommission.Value)

Calculate Min and Max for aggregation in SSRS report

My SSRS report have a dataset that will return the following result. The result set for some reason may not be changed. Note that Category - SubCategory pair might not be distinct.
Category Sub-Category Value
-----------------------------
A A1 100
A A2 120
A A2 60
B B1 80
B B2 90
B B2 70
I want to show the max value and main value for each of the SUM(category, subCategory) in report matrix, as exactly the format as follows (except the comment in bracket):
Max | 180 (two A-A2 rows)
Min | 80 (B-B1)
How can I define the matrix and write the expression? If make a group on these two columns, The matrix will show four rows regardless of what expression I set.
I tried to run your use case on my local SSRS.
On Left hand side I have original Data and on Right hand side I have the desired result you expect.
What you need is grouping as below
Expression for sum as below
Put a tablix into your report. Then at Row Groups (bottom) click on the (Details) and chose Add Group > Parent Group. Click the Add group header and chose your Sub-Category. Do the same with your Category. Your Row Grouping hierarchy should be now Category > Sub-Category > Details.
Now you see the brackets on the left in your tablix, they indicate the level. If you use now the following expression with their group name on the specific level, you will get what you want.
'At the Category group level header
=Sum(Fields!Value, "CategoryGroupName")
'At the Sub-Category group level header
=Sum(Fields!Value, "SubCategoryGroupName")
I got the way to make it. The solution is as follows:
Make a row parent group called row. Let the group group by a constant.
Make a child group category under the row group which is grouped by Category.
In matrix cell which is inside the group, Add this expression: =Min(Sum(Fields!Value.value), "Category"), "row"). that's the reason why I make a constant group, because I want to make the nested aggregate function legal.
This expression will return all values identical within the Category group. Now add another row outside of these row groups. Pick a cell and enter =ReportItems!ThatTextBox.Value.
Hide the row which consists your groups.
Do the same for MAX value (Start from adding an adjacent group, grouping by constant)

How to Combine Fields from Two Datasets SSRS?

I am working on a report to show the total number of hours an employee spent working. Our company tracks labor hours by Service Request and Work Order so I need to bring totals for each into the report.
I created two datasets- one for Work Orders and one for Service Requests. Ideally, I would like to combine the total number of Work Order hours with the total number of Service Request hours and present that number listed by employeeID since both datasets have the employeeID field.
I thought it would be as simple as:
=(SUM(Fields!TOTALHOURS_WO.Value, "DataSet1") + SUM(Fields!TOTALHOURS_SR.Value, "DataSet2"))
I don't get an error, however, I am getting a number which repeats for each employee so I know I'm doing something wrong.
Any help is greatly appreciated.
Mal,
As #StevenWhite mentioned, LOOKUP is probably the function you are looking for.
Here is an example for you. For the example datasets:
EmployeeID | TOTALHOURS_WO
-----------------------------------
123 | 12
456 | 3
EmployeeNum| TOTALHOURS_SR
-----------------------------------
123 | 2
456 | 5
You will note that each table in a SSRS report needs a DataSet assigned to it. I will assume your table is using our first DataSet, which we will name "DataSet1". The second dataset above will be "DataSet2".
For your total hours you will use an expression. It should look something like this:
=TOTALHOURS_WO + LOOKUP(Fields!EmployeeID.Value, Fields!EmployeeNum.Value, Fields!TOTALHOURS_SR.Value, "DataSet2")
So you will be adding the TOTALHOURS_WO from your local dataset to the result from the LOOKUP function. What lookup is doing is taking the first field from your local dataset, finding a match in the dataset provided to the function (as a string), and returning the field from the row it matched to. The last parameter is the dataset to search.
Just in case you get an error... it's always a good idea to cast data to the type you want to work with in case it comes in wrong. So...
=CINT(TOTALHOURS_WO) + CINT(LOOKUP(Fields!EmployeeID.Value, Fields!EmployeeNum.Value, Fields!TOTALHOURS_SR.Value, "DataSet2"))
This assumes you have a one to one match on employee ID. If you have to SUM both fields you can try this:
=SUM(CINT(TOTALHOURS_WO)) + SUM(LOOKUPSET(Fields!EmployeeID.Value, Fields!EmployeeNum.Value, CINT(Fields!TOTALHOURS_SR.Value), "DataSet2"))
SUM for TOTALHOURS_WO will give you the SUM in your current table group (so make sure you are grouping by staff ID in the table). It will then add it to the SUM of LOOKUPSET. LOOKUPSET works the same as lookup but returns an array of matches instead of the first.
Hope this helps.

how to calculate sum of row in crystal report using sql query, and do not display if the sum equals to 0.00

I have the following crystal report, I want to calculate the sum of each row of specific columns:
Opening Quantity
Purchase Quantity
Issue Quantity
if sum of the above 3 columns is equal to 0.00, then do not print that record.
Please look out at the screenshot of generated report:
I am to guess here that the fields are placed in the DETAIL section , if then you can use the suppress formula(Section Expert-->Detail Section-->Suppress formula)
and try something like this
{Opening Quantity field} + {Purchase Quantity field} + {Issue Quantity field} = 0
I think this can give some idea to you
1) you have to create a formula to sum up the opening quantity, purchase quantity and Issue quantity by using Running Total Field.
Let say your field name for opening quantity inside the TableA is 'opening quantity'.
Thus, choose Table A, inside the Running Total Field and find the 'opening quantity'.
Then, choose 'SUM' as Type of Summary.
Do the same for another two fields.
At last, you will have 3 different running total field formula.
2) combine together these 3 formula inside one new formula.
Your final formula should look like this.
Let say you name it as Formula 4
if {#Formula1}+{#Formula2}+{#Formula3}<>0 then {#formula1}+{#formula2}+{#formula3}
then you drag this formula to any space in the report that you want the total to appear.
3) After drag it, right click on the formula and press 'Format Object'
Check the suppress box and write this inside the blue cross tab beside the suppress checkbox
{#Formula4}=0

Matrix by category in SSRS

I want to display my totals by category in Matix and limited 5 columns( +1 header).
How can I achieve it?
I mean I want to get each total for respective ItemID, and I want to display in matrix by running order of ItemID. I want to achieve my matrix as follow: Matrix
enter image description here