all groups > sql server reporting services > march 2008 >
You're in the

sql server reporting services

group:

Sum Totals on Conditional field


Sum Totals on Conditional field Mike
12/7/2004 10:46:44 AM
sql server reporting services:
I am having trouble get the Total on a column, i get the following error:

c:\inetpub\wwwroot\cireports\PurchaseDetails.rdl The value expression for
the textbox 'textbox15' 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.


This is what i have, the report needs to not include a certain value if it
meets a certain condition, also to note the stored procedure that feeds this
report is used in several other parts of the application that this report is
working with, so it is not possible to change the stored procedure to do the
calculations in the stored procedure.

In my Dataset I created a Calculated Field called 'Amt' with the following
expression
=IIF(Fields!Col1.Value = "Condition",0,Fields!Col2.Value)

Then in the Report Designer I created a Report with the following Detail
Columns
=Fields!Col1.Value,
=Fields!Amt.Value,=Fields!Col3.Value,=Fields!Amt.Value-Fields!Col3.Value

Then in the Report Footer I have the following:

For the =Fields!Amt.Value Column I have =Sum(Fields!Amt.Value)
For the =Fields!Col3.Value Column I have =Sum(Fields!Col3.Value)
For the =Fields!Amt.Value-Fields!Col3.Value Column I have
=Sum(Fields!Amt.Value-Fields!Col3.Value)


Everything works except the =Sum(Fields!Amt.Value) total column


Can anyone explain why 2 of the fields that use the Calculated Field as part
of a formula work but the one that is suppose to Sum up the column does not.

Thanks
Mike






Re: Sum Totals on Conditional field Mike
12/7/2004 12:43:42 PM
Okay, i fixed my problem, here is the solution for anyone else who may run
across this

I changed the footer column Sum(Fields!Amt.Value) to
=Sum(CDBL(Fields!Amt.Value))


[quoted text, click to view]

RE: Sum Totals on Conditional field Dave
9/13/2007 3:39:04 PM
THANK YOU!! I had the exact same problem with a "money" column.

From http://www.developmentnow.com/g/115_2004_12_0_0_453764/Sum-Totals-on-Conditional-field.htm

Posted via DevelopmentNow.com Groups
RE: Sum Totals on Conditional field Tom
10/30/2007 10:17:14 PM
Mike - exactly same problem my end. Many Thanks for the simple solution.

From http://www.developmentnow.com/g/115_2004_12_0_0_453764/Sum-Totals-on-Conditional-field.htm

Posted via DevelopmentNow.com Groups
RE: Sum Totals on Conditional field Chad
3/10/2008 11:59:17 AM
Can anyone tell me how I can do this when I am AVG a column. I have the following code =FORMATPERCENT(avg(iif(Fields!hrs_cum.Value = 0, 0, Fields!hrs_cum.Value / iif(Fields!hrs_curterm.Value = 0, 1, Fields!hrs_curterm.Value))))

Now once it finds a zero it outputs a #error. Hoe can I make it handle the zero.

I also get this warning...Aggregate functions other than First, Last, Previous, Count, and CountDistinct can only aggregate data of a single data type.

From http://www.developmentnow.com/g/115_2004_12_0_0_453764/Sum-Totals-on-Conditional-field.htm

Posted via DevelopmentNow.com Groups
AddThis Social Bookmark Button