SSRS MDX - Display measure upto date in fiscal yea

2019-09-13 14:41发布

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.

1条回答
Summer. ? 凉城
2楼-- · 2019-09-13 15:12

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.

查看更多
登录 后发表回答