Showing posts with label calculated. Show all posts
Showing posts with label calculated. Show all posts

Monday, March 12, 2012

Expressions in calucated columns

Where can I find a list of expressions that are allowed in calculated columns?
Thanks
IT PHYTOSAN
On Mon, 3 Oct 2005 15:31:03 -0700, IT PHYTOSAN wrote:

>Where can I find a list of expressions that are allowed in calculated columns?
Hi IT PHYTOSAN,
In Books Online, subject "CREATE TABLE":
computed_column_expression
Is an expression defining the value of a computed column. A computed
column is a virtual column not physically stored in the table. It is
computed from an expression using other columns in the same table. For
example, a computed column can have the definition: cost AS price * qty.
The expression can be a noncomputed column name, constant, function,
variable, and any combination of these connected by one or more
operators. The expression cannot be a subquery.
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Thanks,but what is the syntax? What commands are allowed?
IT PHYTOSAN
"Hugo Kornelis" wrote:

> On Mon, 3 Oct 2005 15:31:03 -0700, IT PHYTOSAN wrote:
>
> Hi IT PHYTOSAN,
> In Books Online, subject "CREATE TABLE":
> computed_column_expression
> Is an expression defining the value of a computed column. A computed
> column is a virtual column not physically stored in the table. It is
> computed from an expression using other columns in the same table. For
> example, a computed column can have the definition: cost AS price * qty.
> The expression can be a noncomputed column name, constant, function,
> variable, and any combination of these connected by one or more
> operators. The expression cannot be a subquery.
>
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
|||Example Script
CREATE TABLE [dbo].[Table1] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[Price] [decimal](18, 0) NOT NULL ,
[Qty] [int] NOT NULL ,
[Total] AS ([Price] * [Qty])
) ON [PRIMARY]
GO
Nik Marshall-Blank MCSD/MCDBA
Linz, Austria
"IT PHYTOSAN" <ITPHYTOSAN@.discussions.microsoft.com> wrote in message
news:B26DE2A2-2E51-4E7B-BADA-FBDE15A48004@.microsoft.com...[vbcol=seagreen]
> Thanks,but what is the syntax? What commands are allowed?
> IT PHYTOSAN
> "Hugo Kornelis" wrote:

Expressions in calucated columns

Where can I find a list of expressions that are allowed in calculated column
s?
Thanks
IT PHYTOSANOn Mon, 3 Oct 2005 15:31:03 -0700, IT PHYTOSAN wrote:
[vbcol=seagreen]
>Where can I find a list of expressions that are allowed in calculated columns?[/vbc
ol]
Hi IT PHYTOSAN,
In Books Online, subject "CREATE TABLE":
computed_column_expression
Is an expression defining the value of a computed column. A computed
column is a virtual column not physically stored in the table. It is
computed from an expression using other columns in the same table. For
example, a computed column can have the definition: cost AS price * qty.
The expression can be a noncomputed column name, constant, function,
variable, and any combination of these connected by one or more
operators. The expression cannot be a subquery.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Thanks,but what is the syntax? What commands are allowed?
IT PHYTOSAN
"Hugo Kornelis" wrote:

> On Mon, 3 Oct 2005 15:31:03 -0700, IT PHYTOSAN wrote:
>
> Hi IT PHYTOSAN,
> In Books Online, subject "CREATE TABLE":
> computed_column_expression
> Is an expression defining the value of a computed column. A computed
> column is a virtual column not physically stored in the table. It is
> computed from an expression using other columns in the same table. For
> example, a computed column can have the definition: cost AS price * qty.
> The expression can be a noncomputed column name, constant, function,
> variable, and any combination of these connected by one or more
> operators. The expression cannot be a subquery.
>
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>|||Example Script
CREATE TABLE [dbo].[Table1] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[Price] [decimal](18, 0) NOT NULL ,
[Qty] [int] NOT NULL ,
[Total] AS ([Price] * [Qty])
) ON [PRIMARY]
GO
Nik Marshall-Blank MCSD/MCDBA
Linz, Austria
"IT PHYTOSAN" <ITPHYTOSAN@.discussions.microsoft.com> wrote in message
news:B26DE2A2-2E51-4E7B-BADA-FBDE15A48004@.microsoft.com...[vbcol=seagreen]
> Thanks,but what is the syntax? What commands are allowed?
> IT PHYTOSAN
> "Hugo Kornelis" wrote:
>

Expressions in calucated columns

Where can I find a list of expressions that are allowed in calculated columns?
Thanks
IT PHYTOSANOn Mon, 3 Oct 2005 15:31:03 -0700, IT PHYTOSAN wrote:
>Where can I find a list of expressions that are allowed in calculated columns?
Hi IT PHYTOSAN,
In Books Online, subject "CREATE TABLE":
computed_column_expression
Is an expression defining the value of a computed column. A computed
column is a virtual column not physically stored in the table. It is
computed from an expression using other columns in the same table. For
example, a computed column can have the definition: cost AS price * qty.
The expression can be a noncomputed column name, constant, function,
variable, and any combination of these connected by one or more
operators. The expression cannot be a subquery.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Thanks,but what is the syntax? What commands are allowed?
IT PHYTOSAN
"Hugo Kornelis" wrote:
> On Mon, 3 Oct 2005 15:31:03 -0700, IT PHYTOSAN wrote:
> >Where can I find a list of expressions that are allowed in calculated columns?
> Hi IT PHYTOSAN,
> In Books Online, subject "CREATE TABLE":
> computed_column_expression
> Is an expression defining the value of a computed column. A computed
> column is a virtual column not physically stored in the table. It is
> computed from an expression using other columns in the same table. For
> example, a computed column can have the definition: cost AS price * qty.
> The expression can be a noncomputed column name, constant, function,
> variable, and any combination of these connected by one or more
> operators. The expression cannot be a subquery.
>
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>|||Example Script
CREATE TABLE [dbo].[Table1] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[Price] [decimal](18, 0) NOT NULL ,
[Qty] [int] NOT NULL ,
[Total] AS ([Price] * [Qty])
) ON [PRIMARY]
GO
--
Nik Marshall-Blank MCSD/MCDBA
Linz, Austria
"IT PHYTOSAN" <ITPHYTOSAN@.discussions.microsoft.com> wrote in message
news:B26DE2A2-2E51-4E7B-BADA-FBDE15A48004@.microsoft.com...
> Thanks,but what is the syntax? What commands are allowed?
> IT PHYTOSAN
> "Hugo Kornelis" wrote:
>> On Mon, 3 Oct 2005 15:31:03 -0700, IT PHYTOSAN wrote:
>> >Where can I find a list of expressions that are allowed in calculated
>> >columns?
>> Hi IT PHYTOSAN,
>> In Books Online, subject "CREATE TABLE":
>> computed_column_expression
>> Is an expression defining the value of a computed column. A computed
>> column is a virtual column not physically stored in the table. It is
>> computed from an expression using other columns in the same table. For
>> example, a computed column can have the definition: cost AS price * qty.
>> The expression can be a noncomputed column name, constant, function,
>> variable, and any combination of these connected by one or more
>> operators. The expression cannot be a subquery.
>>
>> Best, Hugo
>> --
>> (Remove _NO_ and _SPAM_ to get my e-mail address)

expressions based on subtotals

How do I create calculated fields based on subtotals?

SSRS 2005 doesn't support aggregates over aggregates. You should try deriving the total from the details. If you need absolutely to use subtotals, you can write a simple function that let you set/get the total, e.g.

Dim _total as Double

Sub SetTotal (ByVal total As Double) As Double

_total = total

return total

End Function

Function GetTotal() as Double

return _total

End Function

Then, in subtotal textboxes, change their values to =Code.SetTotal(Fields!FieldName.Value). When you need the total call GetTotal, e.g. =Code.GetTotal(). Of course, in real life it may need to write more complex logic to maintain the totals.

|||Thanks for the feedback, I'll give it a try I'm actually trying to create report to emulate growth over period(OLAP) for an Informix datasource I want to see the difference of the yearly subtotals Still exploring options|||was able to nest a table within a matrix and do all my calculations

expressions based on subtotals

How do I create calculated fields based on subtotals?

SSRS 2005 doesn't support aggregates over aggregates. You should try deriving the total from the details. If you need absolutely to use subtotals, you can write a simple function that let you set/get the total, e.g.

Dim _total as Double

Sub SetTotal (ByVal total As Double) As Double

_total = total

return total

End Function

Function GetTotal() as Double

return _total

End Function

Then, in subtotal textboxes, change their values to =Code.SetTotal(Fields!FieldName.Value). When you need the total call GetTotal, e.g. =Code.GetTotal(). Of course, in real life it may need to write more complex logic to maintain the totals.

|||Thanks for the feedback, I'll give it a try I'm actually trying to create report to emulate growth over period(OLAP) for an Informix datasource I want to see the difference of the yearly subtotals Still exploring options|||was able to nest a table within a matrix and do all my calculations

Wednesday, March 7, 2012

Expression for Running Total

I want to write an expression where the running total should be
calculated if the previous value for a column(invoice code) is not
equal to the current value for the invoice code.
The expression should be something like this:
iif( current invoice code is not equal to the previous invoice
code,sum(payment),0)
How can I compare the current and previous value of a column in the
expression?
In Crystal we can say calculate running total with the change of
Invoice Code in the Edit Running Total Field Box. Trying to do the same
concept in RS where the running total should be calculated with the
change of invoice code.
Please help!
ThanksI think you just need to add a (table) grouping to your data (based on
InvoiceCode). In the group header you would do the calculation of the total
payment. In the group details you can show the invoice detail rows.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"bak" <bakgroup@.gmail.com> wrote in message
news:1117132892.250745.323640@.o13g2000cwo.googlegroups.com...
>I want to write an expression where the running total should be
> calculated if the previous value for a column(invoice code) is not
> equal to the current value for the invoice code.
> The expression should be something like this:
> iif( current invoice code is not equal to the previous invoice
> code,sum(payment),0)
> How can I compare the current and previous value of a column in the
> expression?
> In Crystal we can say calculate running total with the change of
> Invoice Code in the Edit Running Total Field Box. Trying to do the same
> concept in RS where the running total should be calculated with the
> change of invoice code.
> Please help!
> Thanks
>|||This did not help. The solution to my problem is to write an
expression where if the current invoice code is not equal to the
previous invoice code then calculate sum. I am unable to find a VB.NET
function which helps me do this.
Can anyone tell me some good sites where I can get information about
all the VB.NET functions that can be used in Reporting Services. I
have been looking for the function in VS.NET documentation but unable
to find something that could help me compare the current and previous
value of a column.
Thanks.