hope use can help me with this:
My dataset uses a pre-built module therefore I cannot use SQL adding a row_number() for the field.
I need to be able to exclude hidden values from SUM as follows:
In the field I used this expression:
IIF(Fields!SpaceID.Value = Previous(Fields!SpaceID.Value), 0, Fields!SpaceArea.Value)
In the Textbox Property for SpaceArea -> Visibility -> show or hide of the field, I also used this expression for hidden:
=IIF(Fields!SpaceID.Value = Previous(Fields!SpaceID.Value),True, False)
And the SUM:
=Sum(IIF(Fields!SpaceID.Value = Previous(Fields!SpaceID.Value), Fields!SpaceArea.Value, Nothing))
Then I got this error message:
previous functions cannot be specified as nested aggregates.
Thank you very much in advance
EDIT 1:
SpaceID SpaceArea RowNumber A 123 1 A 123 2 A 123 3 B 12 1 B 12 2 C 1 1
Notes:
- SpaceID was grouped as
SpaceID_Group
. - The Expected Sum for
SpaceArea = (123 + 12 +1)
. - Cannot use
row_number() over (partition by ... )
because there is no SQL. The query was designed with XML, not SQL.
I managed to create another column in the tablix with the row value
=RowNumber("SpaceID_Group")
.
But I do not know how to refer it to my Sum. which, if I had SQL , it will look like:
sum(iif(Fields!RowNumber.Value = 1, Fields!SpaceArea.Value, Nothing))
Public Shared MyTotal As Integer Function AddTotal(ByVal t As Integer) As Integer MyTotal = MyTotal + t Return Mytotal End Function
Group on the SpaceId (as you already did) and hide it.
Add the expression
Code.AddTotal(Fields!SpaceArea.Value)
to the SpaceId groupAdd the expression
Code.MyTotal
to field summary. In some versions like SSRS 2005, due to execution order you may notice that the calculation returns zero. In this case add a field with the expression bellow the table