Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Services / Reporting Services / November 2006

Tip: Looking for answers? Try searching our database.

Sum with IIF

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruce Lawrence - 30 Nov 2006 19:37 GMT
I'm trying to SUM values using an IF statement.

I have a table that shows employee's time and hours for 3 different
shifts.
The results are grouped so each day I can see the employee total hrs
and also another group that shows the grouped results for a range of
dates.

At the table footer, i'm trying to show the Total Sum of all employees.

Here is my SUM statement
=Sum(IIF(Fields!SHIFT.Value <200, Fields!HOURS.Value,0))

I get an error saying
The value expression for the textbox 'textbox45' uses an aggregate
function on data of varying data types.  Aggregate functions other than
First, Last, Previous, Count, and CountDistinct can only aggregate data
of a single data type.
Kevin - 30 Nov 2006 19:43 GMT
Do some of the values contain decimals and some not? That might be the
issue. If that's the case, consider casting the values to decimal or
double first. There has to be a function to do that in the conversions
sections of the expression builder.

-Kevin

> I'm trying to SUM values using an IF statement.
>
[quoted text clipped - 14 lines]
> First, Last, Previous, Count, and CountDistinct can only aggregate data
> of a single data type.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.