変化が負の場合にこの結果を負に表示したいのですが、mdxが絶対結果を取得しており、常に正の数を示しているように見えます。その3番目の列は、3番目のメンバーで結果が負の場合に負にしたいと思います。
member [Measures].[Change in Reseller Sales Percent]
私はiif-ステートメントでそれを行うことができると思いますが、どのように?
コード:
with
member [Measures].[Prev Month Reseller Sales Amount] as
([Date].[Calendar].currentmember.prevmember,
[Measures].[Reseller Sales Amount])
,format_string="currency"
member [Measures].[Change in Reseller Sales] as
([Measures].[Reseller Sales Amount]-
[Measures].[Prev Month Reseller Sales Amount])
member [Measures].[Change in Reseller Sales Percent] as
iif([Date].[Calendar].currentmember.prevmember is null, null,
([Measures].[Change in Reseller Sales])/
([Measures].[Prev Month Reseller Sales Amount]))
, format_string = "percent"
SELECT
{([Measures].[Reseller Sales Amount]),
([Measures].[Prev Month Reseller Sales Amount]),
([Measures].[Change in Reseller Sales]),
([Measures].[Change in Reseller Sales Percent])} ON COLUMNS,
{[Date].[Calendar].[Month].Members} ON ROWS
FROM [Step-by-Step]
結果:
September 2001 $1,165,897.08 $1,538,408.31 ($372,511.23) -24.21%
October 2001 $844,721.00 $1,165,897.08 ($321,176.08) -27.55%
November 2001 $2,324,135.80 $844,721.00 $1,479,414.80 175.14%
December 2001 $1,702,944.54 $2,324,135.80 ($621,191.25) -26.73%
January 2002 $713,116.69 $1,702,944.54 ($989,827.85) -58.12%