简体   繁体   中英

SSAS MDX Replace (all ) on the date Hierarchy with (YTD)

Hi i have a date hierarchy and i want to replace the (All) with a calculated period like instead of displaying (all) i want it to display (YTD,2016,2015,2014,2013 and so on is it possible

this enter image description here is the query thats producing the (all)

select {} on columns,
[Dim Date].[PA Dates].ALLMEMBERS on rows 
from MyCube 

This is an equivalent script in AdvWrks :

WITH 
  MEMBER [Date].[Day Name].[All].[AllWeek] AS 
    [Date].[Day Name].[All] 
  SET [x] AS 
    {
      Except
      (
        [Date].[Day Name].MEMBERS
       ,[Date].[Day Name].[All]
      )
     ,[Date].[Day Name].[All].[AllWeek]
    } 
SELECT 
  {} ON COLUMNS
 ,[x] ON ROWS
FROM [Adventure Works];

It returns the following:

在此处输入图片说明

So converting to your cube it'll be something like:

WITH 
  MEMBER [Dim Date].[PA Dates].[All].[YTD] AS 
    [Dim Date].[PA Dates].[All] 
  SET [x] AS 
    {
      Except
      (
        [Dim Date].[PA Dates].MEMBERS
       ,[Dim Date].[PA Dates].[All]
      )
     ,[Dim Date].[PA Dates].[All].[AllWeek]
    } 
SELECT 
  {} ON COLUMNS
 ,[x] ON ROWS
FROM [MyCube];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM