Friday, June 22, 2012 11:28 AM
I am trying to create a calculated measure which should work like this:
Calculate result of a formula for each product from product dimension. Then SUM all of these results together.
Pseudo algorithm looks like this:
foreach (product in Dim_Product)
Does anyone know how to write such type of calculation?
Friday, June 22, 2012 1:20 PM
So much depends on the Dimension/attribute factors found in your "RESULT_FROM_SOME_FORMULA" and in the way results have to be displayed.
Some of the items that often come back in loop a-like functionality : members, currentmember, generate(), ..
A simple example close to your pseudo code
WITH MEMBER [Measures].[My measure] AS Sum ( [Product].[Product].[Product].MEMBERS ,F(measure tuple member related to product dimension) ) SELECT [Measures].[My measure] ON 0 FROM [cube];
WITH MEMBER [Measures].[My measure] AS Sum ( [Product].[Product].[Product].MEMBERS ,Int([Measures].[Internet Sales Amount] * 3) ) SELECT [Measures].[My measure] ON 0 FROM [Adventure Works];