Thursday, March 29, 2012

Field Expression Issue

Hello,

I have a field on my SRS report (a picklist) called new_status

How do I place a statement in the expression area of
this field to get a total of all records where new_status.value = 2

I tried entering this expression and received an error.

=SUM(Fields!new_status.Value = 2)

Any help would be appreciated.

Thanks.

I think you want to do something like this:

=SUM(IIF(Fields!new_status.value=2, CInt(Fields!FieldToSum.value), 0))

Assuming there's a field you want to total when the status field equals 2.

|||

Thank you Corwin,

I think I've done something else wrong here because I'm getting a value of 0 for my count.

Here is how I've set things up..

I created a var called TotalCONN
Set it as a calculated field
Set initial value =0

=SUM(IIF(Fields!new_status.value=2, CInt(Fields!TotalCONN.value), 0))

I am getting the value of 0 returned.

Also, I forgot something.. I have to also check to see if new_status value = 1 as well

Any help is appreciated - I am totally stuck on this one.

=SUM(IIF(Fields!new_status.value=2, CInt(Fields!FieldToSum.value), 0))

I want to have a total for my group where new_status.value=1 or new_status=2

|||

You might want to try tackling it one part at a time:

=SUM(Fields!TotalCONN.value) - does this give you a value of all the records? is it correct?

=SUM(CInt(Fields!TotalCONN.value)) - still get the same result? or did the first attempt result in an error because the CInt was missing?

=SUM(IIF(Fields!new_status.value=2, 1, 0) - do you get a value equal to the number of records with that status?

=SUM(IIF(Fields!new_status.value=1, 1, 0) - do you get a value equal to the number of records with that status?

Is TotalCONN a field or a variable? It may be that Fields!TotalCONN.value is the part that is not valid.

No comments:

Post a Comment