Showing posts with label aggregate. Show all posts
Showing posts with label aggregate. Show all posts

Thursday, March 8, 2012

Assigning default aggregate function to calculated member

Is there any way to assign a default aggregate function (e.g. SUM) to a calculated member just like we can do this with a regular measure?

What I need to do is assign a custom calculation in my calculated member at the lowest grain (e.g. scoped at Date.Members and Customer.Members). Everything above this should be summed by default, e.g. Sales Territory.

Unfortunatelly, it is not possible to assign aggregation function to calculated members. If you need to aggregate them - you will have to do it manually with MDX.

The workaround is to use regular dimension members without data instead of calculated members, and assign MDX expressions to them.

|||

Hi, Mosha

Assuming the workaround, Is there difference in performance between a calculated member and a regular measure?

Assigning default aggregate function to calculated member

Is there any way to assign a default aggregate function (e.g. SUM) to a calculated member just like we can do this with a regular measure?

What I need to do is assign a custom calculation in my calculated member at the lowest grain (e.g. scoped at Date.Members and Customer.Members). Everything above this should be summed by default, e.g. Sales Territory.

Unfortunatelly, it is not possible to assign aggregation function to calculated members. If you need to aggregate them - you will have to do it manually with MDX.

The workaround is to use regular dimension members without data instead of calculated members, and assign MDX expressions to them.

|||

Hi, Mosha

Assuming the workaround, Is there difference in performance between a calculated member and a regular measure?

Wednesday, March 7, 2012

Assign Aggregate count results to variable

I have an aggregate transform that outputs two columns, a group by (DT_STR) and a count(column name) (DT_UI8). The results are put into a Recordset Destination. When I attempt to map these columns to variables in a Foreach Loop Container (using a Foreach ADO Enumerator), I get the error:

Error: 0xC001F009 at ExtractNNRPersonUpdates: The type of the value being assigned to variable "User::NNRPersonCount" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.

Error: 0xC001C012 at Foreach Household Loop Container: ForEach Variable Mapping number 2 to variable "User::NNRPersonCount" cannot be applied.

The variable mentioned in the error message is setup as a UInt64. I've tried all other integer data types and nothing works. I also tried changing the data type of the count coming out of the Aggregate transform but received a warning stating this isn't possible.

Any idea what I may be doing wrong?

I had a lot of trouble with this error, and ended up doing explicit casts in a script where I was doing my comparison, using the CType function.

eg:

Row.newid = rowIndex + CType(Me.Variables.MyCounter, ULong)

Dylan.

|||Out of desperation, I began trying all of the data types. When I set it to DBNull, it worked. I was then able to cast it to an integer in a Script Task. Doesn't seem right though because the values are never null.

Assign Aggregate count results to variable

I have an aggregate transform that outputs two columns, a group by (DT_STR) and a count(column name) (DT_UI8). The results are put into a Recordset Destination. When I attempt to map these columns to variables in a Foreach Loop Container (using a Foreach ADO Enumerator), I get the error:

Error: 0xC001F009 at ExtractNNRPersonUpdates: The type of the value being assigned to variable "User::NNRPersonCount" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.

Error: 0xC001C012 at Foreach Household Loop Container: ForEach Variable Mapping number 2 to variable "User::NNRPersonCount" cannot be applied.

The variable mentioned in the error message is setup as a UInt64. I've tried all other integer data types and nothing works. I also tried changing the data type of the count coming out of the Aggregate transform but received a warning stating this isn't possible.

Any idea what I may be doing wrong?

I had a lot of trouble with this error, and ended up doing explicit casts in a script where I was doing my comparison, using the CType function.

eg:

Row.newid = rowIndex + CType(Me.Variables.MyCounter, ULong)

Dylan.

|||Out of desperation, I began trying all of the data types. When I set it to DBNull, it worked. I was then able to cast it to an integer in a Script Task. Doesn't seem right though because the values are never null.