Search code examples
sql-server-2008olapcubessas

Add translations to calculated member through AMO


I am using AMO to programmatically generate an OLAP Cube. How can I add translations for the calculated members? (SQL Server 2008)

I have tried as follows, but it does not work:

MdxScript mdx = cube.MdxScripts[0];
CalculationProperty calculation = new CalculationProperty();
calculation.CalculationReference = "[Calculated measureName]";
calculation.CalculationType = CalculationType.Member;
Translation translation = new Translation();
translation.Caption = "Some Caption";
translation.Language = "Language Code";
calculation.Translations.Add(translation);
mdx.CalculationProperties.Add(calculation);

Solution

  • I have found the problem in the code above, the CalculationReference property should be set to "[Measures].[Calculated measureName]".