I need to get the aggregated values based on two conditions using single MDX query
I have created two calculated functions using IIF() function in a below query
WITH
MEMBER [Measures].[Expression1] AS IIF([EMPLOYEE].[TITLE].CURRENTMEMBER.MEMBERVALUE = "SALES REPRESENTATIVE",[Reseller Order Count],0)
MEMBER [Measures].[Expression2] AS IIF([EMPLOYEE].[TITLE].CURRENTMEMBER.MEMBERVALUE = "SALES REPRESENTATIVE",0,[Reseller Order Count]) SELECT{
[Measures].[Expression1],
[Measures].[Expression2]} ON COLUMNS FROM [Sales Targets] CELL PROPERTIES VALUE, FORMATTED_VALUE, FORMAT_STRING
The output must be 3693 and 103 but it returned as below
Isthere any changes need to be done in query?
Can anyone please guide me to get the proper result?
You had the right idea but needed to perform this calculation across employee titles:
WITH
MEMBER [Measures].[Expression1] AS
SUM(
[EMPLOYEE].[TITLE].[TITLE].MEMBERS,
IIF([EMPLOYEE].[TITLE].CURRENTMEMBER IS [EMPLOYEE].[TITLE].[SALES REPRESENTATIVE],[Reseller Order Count],Null)
)
MEMBER [Measures].[Expression2] AS
SUM(
[EMPLOYEE].[TITLE].[TITLE].MEMBERS,
IIF([EMPLOYEE].[TITLE].CURRENTMEMBER IS [EMPLOYEE].[TITLE].[SALES REPRESENTATIVE],Null,[Reseller Order Count])
)
SELECT{
[Measures].[Expression1],
[Measures].[Expression2]} ON COLUMNS FROM [Sales Targets] CELL PROPERTIES VALUE, FORMATTED_VALUE, FORMAT_STRING