Sunday, March 11, 2012

errors in creating a cube by AMO

Hello

I am creating a cube in C# by AMO. I created data source view with two table and one relation, one table is dimension and another one is fact. Then I added a dimension to db. This dimesnion has two attribute one key and one regular. The key attribute has a AttributeRelationship to another attribute. After that I updated database and every thing is ok. Then I want to add cube. First I add it

Cube cube = db.Cubes.Add("MyCube");

cube.Dimensions.Add("T Deal");

cube.Validate(errors);

Still the errors.Count is 0. Then I create a MeasureGroup and add a Measure to that.

MeasureGroup measureGroup = cube.MeasureGroups.Add("Vw Cube Fact");

Microsoft.AnalysisServices.Measure measure = measureGroup.Measures.Add("Vw Cube Fact");

measure.Source = new DataItem("vw_CubeFact", "RES Notional");

measureGroup.Validate(errors);

but here there is an error as

No dimension relationships exist. The measure group 'Vw Cube Fact' is not related to any dimensions.

After that I try to add a dimension by

RegularMeasureGroupDimension rmgd = measureGroup.Dimensions.Add("T Deal");

rmgd.Validate(errors);

But the numbers of errors increased to two and the second one is

Granularity is not defined.

Can anybody please help me how can I fix it.

Thanks in advance

Mohsen

I did a mistake in setting AttributeRelationShips.

a very good reference is http://msdn2.microsoft.com/en-us/library/ms345091.aspx

No comments:

Post a Comment