简体   繁体   中英

SSRS MDX - Display measure upto date in fiscal year, display all children in fiscal year

Using this script

SELECT  [Date].[Fiscal Year-Month].[Fiscal Year].&[2012/13].Children ON ROWS
        , [Measures].[Capacity] ON COLUMNS

FROM    [CubeName]

I get the following result:

        Capacity
Apr-12  81.07%
May-12  81.99%
Jun-12  82.29%
Jul-12  82.13%
Aug-12  82.47%
Sep-12  79.10%
Oct-12  (null)
Nov-12  (null)
Dec-12  (null)
Jan-13  (null)
Feb-13  (null)
Mar-13  (null)

What I am looking to do is produce a monthly report for the position upto the end of July showing the values for each month, therefore I wish to exclude August and September from the measure but I want to keep the months from the date dimensions for the report layout. The end result should be:

        Capacity
Apr-12  81.07%
May-12  81.99%
Jun-12  82.29%
Jul-12  82.13%
Aug-12  (null)
Sep-12  (null)
Oct-12  (null)
Nov-12  (null)
Dec-12  (null)
Jan-13  (null)
Feb-13  (null)
Mar-13  (null)

How can I achieve this with MDX? This would then be used in a matrix within SSRS 2008.

With a query like this:

WITH MEMBER [Measures].[Capacity2] AS IIf('[Date].[Fiscal Year-Month].CurrentMember is August or September', Null, [Measures].[Capacity])
SELECT  [Date].[Fiscal Year-Month].[Fiscal Year].&[2012/13].Children ON ROWS,
[Measures].[Capacity2] ON COLUMNS
FROM [CubeName]

You just have to write the correct condition in the IIf.

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