Hi,
We are building a cube with 4 parent-child dimensions and 2 regular dimensions, but because of business requirements all of the parent-child dimensions doesn't aggregate directly in to a sum function and here begins our problem.
When we determine the way the cube will aggregate in the MDX script, the first 2 dimensions works fine, but after that the MDX script is not even considered.
Does anyone have an idea of what's the problem? Next is the latest version of the MDX script.
Thank you
Rafael Augusto
------------------------------------------------------------
/*Sector Institucional*/
scope([P_Sector_Institucional].[Sectores].members);
this = iif( not(isempty(calculationpassvalue((tuple with all the parent-child dimensions),0))),
calculationpassvalue((tuple with all the parent-child dimensions),0),
sum ([P_Sector_Institucional].[Sectores].currentmember.children));
end scope;
/*País*/
scope([P_País].[Países].members);
this = calculationpassvalue((tuple with all the parent-child dimensions),0);
end scope;
/*Instrumento*/
scope([P_Instrumento].[P_Instrumento].members);
this =
iif ([P_Instrumento].[P_Instrumento].currentmember.children.count>0, /*if the member has children*/
iif (not(isempty(calculationpassvalue((tuple with all the parent-child dimensions),0))), /*if the member has a value*/
iif( ([P_Instrumento].[P_Instrumento].currentmember is [P_Instrumento].[P_Instrumento].&[A950] or [P_Instrumento].[P_Instrumento].currentmember is [P_Instrumento].[P_Instrumento].&[P960] or isempty(sum([P_Instrumento].[P_Instrumento].currentmember.children))),
calculationpassvalue((tuple with all the parent-child dimensions),0), /*ignores the children's values*/
iif( ([P_Instrumento].[P_Instrumento].currentmember is [P_Instrumento].[P_Instrumento].&[P750760]),
sum (except([P_Instrumento].[P_Instrumento].currentmember.children, StrToSet("{" + MemberToStr([P_Instrumento].[P_Instrumento].currentmember.datamember) + "," + MemberToStr([P_Instrumento].[P_Instrumento].&[P75076010]) + "}" ))),
sum (except([P_Instrumento].[P_Instrumento].currentmember.children, StrToSet("{" + MemberToStr([P_Instrumento].[P_Instrumento].currentmember.datamember) + "}" )))
)
),
iif( ([P_Instrumento].[P_Instrumento].currentmember is [P_Instrumento].[P_Instrumento].&[P750760]),
sum (except([P_Instrumento].[P_Instrumento].currentmember.children, StrToSet("{" + MemberToStr([P_Instrumento].[P_Instrumento].&[P75076010]) + "}" ))),
sum([P_Instrumento].[P_Instrumento].currentmember.children)
)
),
calculationpassvalue((tuple with all the parent-child dimensions),0)
);
end scope;
/*divisa*/
scope([P_Divisa].[Divisas].members(0));
this = iif ([P_Divisa].[Divisas].currentmember is [P_Divisa].[Divisas].members(0),
sum([P_Divisa].[Divisas].currentmember.children),
calculationpassvalue((tuple with all the parent-child dimensions),0));
end scope
We are building a cube with 4 parent-child dimensions and 2 regular dimensions, but because of business requirements all of the parent-child dimensions doesn't aggregate directly in to a sum function and here begins our problem.
When we determine the way the cube will aggregate in the MDX script, the first 2 dimensions works fine, but after that the MDX script is not even considered.
Does anyone have an idea of what's the problem? Next is the latest version of the MDX script.
Thank you
Rafael Augusto
------------------------------------------------------------
/*Sector Institucional*/
scope([P_Sector_Institucional].[Sectores].members);
this = iif( not(isempty(calculationpassvalue((tuple with all the parent-child dimensions),0))),
calculationpassvalue((tuple with all the parent-child dimensions),0),
sum ([P_Sector_Institucional].[Sectores].currentmember.children));
end scope;
/*País*/
scope([P_País].[Países].members);
this = calculationpassvalue((tuple with all the parent-child dimensions),0);
end scope;
/*Instrumento*/
scope([P_Instrumento].[P_Instrumento].members);
this =
iif ([P_Instrumento].[P_Instrumento].currentmember.children.count>0, /*if the member has children*/
iif (not(isempty(calculationpassvalue((tuple with all the parent-child dimensions),0))), /*if the member has a value*/
iif( ([P_Instrumento].[P_Instrumento].currentmember is [P_Instrumento].[P_Instrumento].&[A950] or [P_Instrumento].[P_Instrumento].currentmember is [P_Instrumento].[P_Instrumento].&[P960] or isempty(sum([P_Instrumento].[P_Instrumento].currentmember.children))),
calculationpassvalue((tuple with all the parent-child dimensions),0), /*ignores the children's values*/
iif( ([P_Instrumento].[P_Instrumento].currentmember is [P_Instrumento].[P_Instrumento].&[P750760]),
sum (except([P_Instrumento].[P_Instrumento].currentmember.children, StrToSet("{" + MemberToStr([P_Instrumento].[P_Instrumento].currentmember.datamember) + "," + MemberToStr([P_Instrumento].[P_Instrumento].&[P75076010]) + "}" ))),
sum (except([P_Instrumento].[P_Instrumento].currentmember.children, StrToSet("{" + MemberToStr([P_Instrumento].[P_Instrumento].currentmember.datamember) + "}" )))
)
),
iif( ([P_Instrumento].[P_Instrumento].currentmember is [P_Instrumento].[P_Instrumento].&[P750760]),
sum (except([P_Instrumento].[P_Instrumento].currentmember.children, StrToSet("{" + MemberToStr([P_Instrumento].[P_Instrumento].&[P75076010]) + "}" ))),
sum([P_Instrumento].[P_Instrumento].currentmember.children)
)
),
calculationpassvalue((tuple with all the parent-child dimensions),0)
);
end scope;
/*divisa*/
scope([P_Divisa].[Divisas].members(0));
this = iif ([P_Divisa].[Divisas].currentmember is [P_Divisa].[Divisas].members(0),
sum([P_Divisa].[Divisas].currentmember.children),
calculationpassvalue((tuple with all the parent-child dimensions),0));
end scope