问题
(this question continues thread "SSRS mdx report: use dimension on columns", answered by @whytheq)
This correct code was built in the previouse thread:
WITH
MEMBER [Measures].[Contacts] AS
IIF([Sales_step].CURRENTMEMBER IS [Sales_step].&[contact], [Measures].[Qnt], null)
MEMBER [Measures].[Clients] AS
IIF([Sales_step].CURRENTMEMBER IS [Sales_step].&[client], [Measures].[Qnt], null)
MEMBER [Measures].[Funded] AS
IIF([Sales_step].CURRENTMEMBER IS [Sales_step].&[funded], [Measures].[Qnt], null)
SELECT {[Measures].[Contacts],
[Measures].[Clients],
[Measures].[Funded]} ON COLUMNS,
NON EMPTY
crossjoin({[City].CHILDREN},
{[Sales_step].CHILDREN}) ON ROWS
FROM ( SELECT ( [Sales_step].MEMBERS ) ON COLUMNS
FROM [SALES_PIPE])
it produces proper result:
Now I want to reduce quantity of rows to one [City] dimension only to get result like:
To do that I've tried 2 changes to the code:
(1) remove crossjoin:
NON EMPTY
crossjoin({[City].CHILDREN},
{[Sales_step].CHILDREN}) ON ROWS
with one [City] dimension only:
NON EMPTY [City].CHILDREN ON ROWS
(2) leave crossjoin and incapsulate it in Extract() func:
Extract(
crossjoin({[City].CHILDREN},
{[Sales_step].CHILDREN}),
[City]) ON ROWS
but both variants give empty cells:
How can I get brief results for one [City] dimension on rows only?
回答1:
If you try switching your measures to tuples what happens?
WITH
MEMBER [Measures].[Contacts] AS
(
[Sales_step].&[contact]
,[Measures].[Qnt]
)
MEMBER [Measures].[Clients] AS
(
[Sales_step].&[client]
,[Measures].[Qnt]
)
MEMBER [Measures].[Funded] AS
(
[Sales_step].&[funded]
,[Measures].[Qnt]
)
SELECT
{
[Measures].[Contacts]
,[Measures].[Clients]
,[Measures].[Funded]
} ON COLUMNS
,NON EMPTY
[City].Children ON ROWS
FROM
(
SELECT
[Sales_step].MEMBERS ON COLUMNS
FROM [SALES_PIPE]
);
回答2:
Simply have:
SELECT NON EMPTY [City].CHILDREN ON ROWS,
NON EMPTY [Sales_step].CHILDREN ON COLUMNS
FROM [SALES_PIPE]
WHERE ([Measures].[Qnt])
来源:https://stackoverflow.com/questions/31648124/ssrs-mdx-report-dimenstion-on-columns-outputs-nulls-if-not-selected-on-rows-als