Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sum (expression)

Posted on 2013-06-10
1
Medium Priority
?
400 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 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

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 part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

721 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