SQL Server 2005 Reporting Services - uses an aggregate function on data of varying data types error

Posted on 2006-04-18
Last Modified: 2008-12-08
New to Reporting Services and .Net as of yesterday <grin> from many years as a Crystal report user.  

I have this formula in my detail as a column:

= IIf(Fields!AGNGBUKT.Value = 1,Fields!CURTRXAM.Value,0)

Which gives me detail as follows:

I am grouping by customer and I want to sum this field at the group level.

 IIf(Fields!AGNGBUKT.Value = 1,Fields!CURTRXAM.Value,0)

if I preview and my column detail results are


I am getting the following error:
[rsAggregateOfMixedDataTypes] The Value expression for the textbox ‘CustCurrentSum’ 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.

if I preview and my column detail results are

My sum works perfectly

After doing some research it looks like because CURTRXAM is a currency field it does not translate the 0 as also being a currency? Instead it is an integer?

So this is really my detail result?

0 integer
1.25 currency
1.65 currency
0 integer

and it is puking trying to summarize what it thinks are different data types?

So how do I indicate that the zero in the following function should be considered a currency type too?

= IIf(Fields!AGNGBUKT.Value = 1,Fields!CURTRXAM.Value,0)

This specific 'manual crosstab' scenario is one I am going to run into extensively trying to translate Reports desinged in Crystal to RS 2005, I appreciate any assistance in understanding the syntax and what exactly isn't working.

Thanks again
Question by:djehmli

    Author Comment

    I found the answer to my question, in case any other new user to Report Services and .Net runs into the same scenario.

    = IIf(Fields!AGNGBUKT.Value = 1,Cint(Fields!CURTRXAM.Value),0)

    I had to change the currency field to integer.

    Accepted Solution

    Closed, 300 points refunded.
    The Experts Exchange
    Community Support Moderator of all Ages

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    1. Set up your parameter at the report level as usual, check the box Multi-value, and set the Data Type to String 2. Set the Stored Procedure Parameter to varchar(max)  --<---- This part here is the key to it's success Example:    @cst_key var…
    Problem Statement In an SAP BI BO Integration project when a BO universe is built on a BEx query, there can be an issue of unit & formatted value objects not getting generated in a BO universe for some key figures. This results in an issue whereb…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    746 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

    13 Experts available now in Live!

    Get 1:1 Help Now