I have a problem here, Have an SSRS report for Bank Transfer see attached
I would like to add a row expression which will Sum the total amount of the same bank, i.e, 03001 - Standard Chartered Bank Ltd BJL, 03002 - Standard Chartered Bank Ltd sk and 03002 - Standard Chartered Bank Base are all standard charters, i would like to get a total of all standard charters GMD figures. if need more clarification, please ask.
NB: Banks which are together e.g Standard charters above have a common field called BankAName. So the sum condition can be set to check if BankAName is the same.
Using IIF Function in SSRS We are going to add a new field to the report data set to determine if the Order Year is the Max or Current Year. As shown below, the dataset properties window is opened, and the Fields tab is selected. After clicking Add, at the bottom of the list a new field is added.
In the tablix data region row group area, right-click a cell in the column group area for which you want totals, then point to Add Total, and click Before or After. A new column outside the current group is added to the data region, and then a default total is added for each numeric field in the column.
Right-click the data region cell that contains the [LineTotal] expression, and select Add Total. Report Designer adds a row with a sum of the dollar amount for each order. Right-click the cell that contains the field [Qty] , and select Add Total.
You'll need something like this:
=Sum(IIf(Fields!BankAName.Value = "Standard Chartered Bank"
, Fields!Amount.Value
, Nothing)
, "DataSet1")
This checks for a certain field (e.g. BankAName
), and if it's a certain value that row's Amount
value will be added to the total - this seems to be what you're after. You may have to modify for your field names/values.
By setting the Scope of the aggregate to the Dataset this will apply to all rows in the table; you can modify this as required.
Modify your SQL query and add the new column showing the value you want
SELECT *, SUM(Amount) OVER(Partition By BankAName) AS BankANameSum
FROM myTable
Where Cond1 = Cond2
BankANameSum is the data field you can use in report design as it is. No need to apply any logic.
HTH.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With