Solved

Sum (expression)

Posted on 2013-06-10
1
395 Views
Last Modified: 2013-06-11
How can I get a total for the column that has this expression.
= iif(First(Fields!CurrencyBefore.Value, "dsAssociateClinic") = True, 
First(Fields!CurrencySymbol.Value, "dsAssociateClinic") & 
Format(iif(Sum(Fields!DiscountedPrice.Value, "dsAssociateClinic") < Fields!ToValue.Value, 
		iif( Sum(Fields!DiscountedPrice.Value, "dsAssociateClinic") - Fields!FromValue.Value > 0,
			(Sum(Fields!DiscountedPrice.Value, "dsAssociateClinic") - Fields!FromValue.Value) * Fields!Rate.Value,
			0),
			(Fields!ToValue.Value - Fields!FromValue.Value) * Fields!Rate.Value), "#,##0.00")

, 
Format(iif(Sum(Fields!DiscountedPrice.Value, "dsAssociateClinic") < Fields!ToValue.Value, 
		iif( Sum(Fields!DiscountedPrice.Value, "dsAssociateClinic") - Fields!FromValue.Value > 0,
			(Sum(Fields!DiscountedPrice.Value, "dsAssociateClinic") - Fields!FromValue.Value) * Fields!Rate.Value,
			0),
			(Fields!ToValue.Value - Fields!FromValue.Value) * Fields!Rate.Value), "#,##0.00")
& First(Fields!CurrencySymbol.Value, "dsAssociateClinic"))

Open in new window

0
Comment
Question by:Eamon
1 Comment
 
LVL 32

Accepted Solution

by:
bhess1 earned 500 total points
ID: 39235887
Note - I simplified the code a bit for a clearer understanding of it (the reformatting is optional - it is just my formatting style):

=Format(
	iif(Sum(Fields!DiscountedPrice.Value, "dsAssociateClinic") < Fields!ToValue.Value, 
		iif( Sum(Fields!DiscountedPrice.Value, "dsAssociateClinic") - Fields!FromValue.Value > 0,
			(Sum(Fields!DiscountedPrice.Value, "dsAssociateClinic") - Fields!FromValue.Value) * Fields!Rate.Value,
			0
			),
		(Fields!ToValue.Value - Fields!FromValue.Value) * Fields!Rate.VALUE
		), 
	iif(First(Fields!CurrencyBefore.Value, "dsAssociateClinic") = True, First(Fields!CurrencySymbol.Value, "dsAssociateClinic") & "#,##0.00", "#,##0.00" & First(Fields!CurrencySymbol.Value, "dsAssociateClinic"))
	)

Open in new window

Your simplest solution would be a hidden column as the source of the data with only the values resulting from the conditional checks, with this column referencing that column for its output.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

789 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