Solved

Sum (expression)

Posted on 2013-06-10
1
398 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 32

Accepted Solution

by:
Brendt Hess 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

634 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