August 16, 2011 at 9:02 am
I am running a simple query that goes and gets the last 3100 entries:
SELECT TOP (3100) [Column 5], [Column 6]
FROM Database1
WHERE ([Column 2] = '6059')
I am building a report that will do this for multiple customers (column 2)
Column 5 is a timestamp and column 6 is a value. I want to calculate in a new column consumption which would be column 6 value minus the previous column 6 value.
I attempted add the field via the expression builder and it came up with this:
=Fields!Column_6.Value-Previous(Fields!Column_6.Value)
When previewing the report i receive an internal error on the report server.
I have also attached the code of part of the report:
</DataSources>
<DataSets>
<DataSet Name="DataSet1">
<Fields>
<Field Name="Column_5">
<DataField>Column 5</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Column_6">
<DataField>Column 6</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Consumption">
<Value>=Fields!Column_6.Value-Previous(Fields!Column_6.Value)</Value>
</Field>
</Fields>
<Query>
<DataSourceName>Denver_Steam</DataSourceName>
<CommandText>SELECT TOP (3100) [Column 5], [Column 6]
FROM Database1
WHERE ([Column 2] = '6059')
ORDER BY [Column 5]</CommandText>
</Query>
Thanks,
Michael
August 16, 2011 at 9:54 am
Is it possible it's in a chart or data matrix region of the report? If so, MSDN says it won't work.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
August 16, 2011 at 10:03 am
When I remove the consumption column it works fine so I believe there is a problem with the =Fields!Column_6.Value-Previous(Fields!Column_6.Value) statement.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply