how to do division in sub total in SSRS - reporting-services

I developed a SSRS report. The output is as below
Here i have subtotal for amt, cust and Tbl. I need subtotal for Avg also.
I tried below formulas in the subtotal columns
=[Sum(total)]/[Sum(cust_count)]
and the output is as below
How can i achieve the same?

You can use this expression:
=Sum(Fields!amt.Value) / Sum(Fields!cust.Value)
Assuming that:
Sum(Fields!amt.Value) is the expression used to obtain 183.00 in you example
Sum(Fields!cust.Value) is the expression used to obtain 8.00 in you example

Related

SSRS how to show pre-calculated totals

I have a data like
which comes from SSAS. Amount_YTD and Amount_YTE values are as Measures.
YTDs are Year-To-Date values, and YTEs are Year-To-End values regardless of Month filter.
My report design is
So, with this design, YTD and YTE values are SUMed (naturally) and what I get is
So row and column totals and grand totals are not as expected. This is what I would like to achieve,
(some rounding may occur)
How can I get "Expected" report?
For ALI you need to use MAX instead of sum for YTD and MIN instead of sum for YTE looking at your data.
For your other two summary lines toplam and Genel Toplam I would alter your ssas query so that it gives YTD and YTE figures regardless of both customer and month and use these figures in the YTD and YTE columns

Reporting services get total sum

I want to get the total sum of a particular column in a report. I have tried using =Sum(Fields!baseline_number.Value) but this gets the sum for each row and when I use
=RunningValue(Fields!Quantity.Value, Sum, Nothing)
I get the cumulative sum. I wouldn't mind using =RunningValue(Fields!Quantity.Value, Sum, Nothing) then getting the final value because this would be the sum for all the rows. Is there a simpler way to achieve getting the total for a certain row in a report?

SUM of a SUM in SSRS 2008

I've this report
Here I make the first sum because I've grouped values from each month (months are "Gennaio", "Febbraio", "Marzo" etc etc.). These values are hidden, but anyway I get the sum and I display the sum for each month.
Then I should make the second sum that use values for each month and display the total for each category. Categories are "TOTALE LAVORI RESTAURO", "TOTALE LAVORI EDILE" etc.)
This is the final sum, where I sum values from each category.
Everything is working well, but now I have to add a "month" parameter to the report that returns sums until a selected month. This parameter changes the sum 1 with this expression:
=Sum(IIf(Fields!mese.Value <= Parameters!mese.Value, Fields!costi.Value, 0))
Now, how should I change expression in SUM2 and SUM3 to work with this parameter?
If I copy that code, ther returns #Error and as far as I know I can't use ReportItems sum.
So any suggestion?
SUM #1 could remain Sum(Fields!costi.Value) because you need to display every months.
i.e.: display GIUGNO even if Parameters!mese.Value = 4 (APRILE).
So you have only to change SUM #2 and #3 because TOTALE LAVORI RESTAURO and TOTALI must show only costi from GENNAIO to Parameters!mese.Value; i.e. if Parameters!mese.Value = 4 display only GENNAIO-APRILE even if we have details about GIUGNO.
The expression gave error because you have NULL value in Fields!costi.Value or Fields!mese.Value: convert this value to zero in your DataSet and you won't have problems.

Which table hold the tax for sales order?

I create SSRS report that read data from Sales order in AX 2012.
In my SSRS report I want to calculate Total Amount and VAT for the Sales Order but i can't find where can get the tax for sales order.
There is no simple answer for this, but you should not use the tables your self, but use the class SalesTotals to calculate.
You may also consider looking at class SalesConfirmDP to see how in does its job.

SQL Server Reporting Services Running Total Over Aggregated Data

Everyone,
In SSRS, we have 2 columns as laid out below.
Sales | Running Sales
5.00 | 5.00
3.00 | 8.00
1.00 | 9.00
The distinction is that the first column (sales) is a is a grouping row and thus to get a Total for Sales per row, we are using =Sum(Fields!Sales.Value).
The problem occurs that when I try to use running value to get a running sales total. It gives me the SSRS error that Aggregate functions can only be used on page headers and footers. In this case it makes no sense to have the total in the footer. Does anyone know a solution/workaround to this problem.
Thanks.
I had the same problem; here is how I solved it.
So here is how to subtotal a column that is itself a sum function. SSRS 2005 wont allow you to aggregate an aggregate function. For example, the total of a column showing a Running Total, useful in daily stock balance calculations.
Add the following code to the report Report > Properties
Dim public totalBalance As Decimal
Public Function AddTotal(ByVal balance As Decimal) AS Decimal totalBalance = totalBalance + balance return balance
End Function
Public Function GetTotal() return totalBalance
End Function
This code adds two variables: totalbalance and cnt as decimal numbers. And two functions AddTotal and GetTotal.
AddTotal allows items in rows to be added up, use as follows in a value cell, where you had;
=RunningTotal(Fields!ColumnName.Value,sum,nothing)
with
=Code.AddTotal(RunningTotal(Fields!ColumnName.Value,sum,nothing))
in the total cell, where it you were unable to simply use
=sum(RunningTotal(Fields!ColumnName.Value,sum,nothing))
use instead
=Code.GetTotal()
Simply add more variables and public functions if you need to sum the sum of more that one field.
http://blog.wingateuk.com/2011/09/ssrs-aggregate-of-aggregate.html