动态生成MDX查询
MeasureList , 度量列表
DimensionList , 维度列表
AttributeList, 属性列表
for (int m = 0; m < MeasureList.Length; m++)
{
measureAll += @"([Measures].[" + MeasureList[m] + @"])";
if (!(m == MeasureList.Length - 1))
measureAll += @",";
}
for (int d = 0; d < DimensionList.Length; d++)
{
dimensionAll += @"[" + DimensionList[d] + @"].[" + AttributeList[d] + @"].AllMembers";
if (!(d == DimensionList.Length - 1))
dimensionAll += @",";
}
finalQuery = @"SELECT {" + measureAll + "} on Columns , {(" + dimensionAll + ")} ON rows FROM [Analysis Service Demo]";