Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sum (expression)

Posted on 2013-06-10
1
Medium Priority
?
401 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:
Brendt Hess earned 2000 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

824 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