Question

I'm quite new to MDX and im having some trouble getting the following t-sql query to MDX.

select distinct
  System
from Systen
  where System <> 'MIS'
UNION
  SELECT  'ALL'

So far i got something like this. But i have no idea how to add that final row 'ALL'.

SELECT 
  {} ON COLUMNS,
  {[Concesionario].[Sistema].[Sistema].ALLMEMBERS} ON ROWS
FROM 
(
  SELECT 
    -
      {
        [Concesionario].[Sistema].&[]
       ,[Concesionario].[Sistema].&[MIS]
      } ON COLUMNS
  FROM [DW]
);

Any idea how to do this?

Thanks

Was it helpful?

Solution

If your Sistema attribute is aggregatable it should already have an "All" member. The problem is that you are selecting from the Sistema level [Concesionario].[Sistema].[Sistema].ALLMEMBERS because you are using the .

So you could change your query to the following:

SELECT   
  {} ON COLUMNS,
  {[Concesionario].[Sistema].ALLMEMBERS} ON ROWS
FROM
 (
  SELECT
    {
        [Concesionario].[Sistema].&[]
       ,[Concesionario].[Sistema].&[MIS]
      } ON COLUMNS
  FROM [DW]
);

But it would be even easier to just put the members you want directly in the axis rather than using a sub-select.

SELECT   
 {} ON COLUMNS,  
 {[Concesionario].[Sistema].[All] ,[Concesionario].[Sistema].&[MIS]  } ON COLUMNS  
FROM [DW]);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top