2
我希望此結果在負值變化時顯示負值,但看起來像mdx正在取絕對值並始終顯示正值。它的第三列我要讓負時,結果在第三位成員是否定的:iif mdx結果應該是負值
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%
@empo,謝謝你的回答,我今天已經離開工作,明天我會看看它。 – 2013-03-20 20:24:51