I have a simple table in ssrs where data is returned from a stored procedure.
I have detail data group totals of the detail data.
I want to be able to create a sum of the detail data matching certain criteria.
i.e.
I have the following total field
sum(Fields!hours_m2.Value)
what I also want to be able to do is create a conditional formula like ...
sum(iif(Fields!Sort_Order.Value = "E1",Fields!hours_m2.Value,0))
When I create this on my report and preview it I get the following message in the field #Error.
Can someone please tell me where I've gone wrong and how to fix ... I know I can change the stored proc but I have 12 columns which I want to do the same thing with which would mean adding 12 columns to my stored proc.
Hello Derek,
In Visual Studio, click on the preview tab and run your report. Then look in the Output window (Ctrl+Alt+O), it should have a description as to what the error is. Can you post that error message?
Jarret
|||One of the things I have found out about summing in ssrs is that it treats values of doubles and integers seperatley.
try changing the the "0" to "0.0" this will then tell ssrs it is a double type and your sum should work.
|||description of error message
[rsAggregateOfMixedDataTypes] The Value expression for the textbox ‘textbox101’ 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.
|||I have found that using the following
sum(iif(Fields!Sort_Order.Value = "E1" or Fields!Sort_Order.Value = "E2" or Fields!Sort_Order.Value = "F1",cdbl(Fields!hours_m2.Value),cdbl(0.0)))
works
Thanks for you responses
|||The problem is as Mainiac said. Try this:
=sum(iif(Fields!Sort_Order.Value = "E1", cDec(Fields!hours_m2.Value), cDec(0)))
Hope this helps.
Jarret
No comments:
Post a Comment