Solved

Sum (expression)

Posted on 2013-06-10
1
389 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Need Counts 11 40
Javascript in a user control not working 17 52
SQL server 2008 SP4 29 31
Calling stored proc in EDMX 11 17
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now