• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4272
  • Last Modified:

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

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:
Current
0
0
4.55
1.25
0

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



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

if I preview and my column detail results are

0
4.55
1.25
0

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
1.25
4.55
3.00

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
Julie
0
djehmli
Asked:
djehmli
1 Solution
 
djehmliAuthor Commented:
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.
0
 
GranModCommented:
Closed, 300 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now