Mdx

在 MDX 中用列 FORMAT_STRING 覆蓋行 FORMAT_STRING

  • August 18, 2017

有誰知道如何用列上的格式字元串覆蓋行上的格式字元串?

我有如下查詢:

WITH
   MEMBER [Measures].[ROH Total Sold Gross]                AS [Measures].[ROH Total Sold Dollars] - [Measures].[ROH Total Sold Cost], FORMAT_STRING='Currency'

   MEMBER [ClosedDate].[Date].[MTD]                        AS AGGREGATE([ClosedDate].[Date].[2017-07-01]:[ClosedDate].[Date].[2017-07-31])
   MEMBER [ClosedDate].[Date].[PrevMTD]                    AS AGGREGATE([ClosedDate].[Date].[2017-06-01]:[ClosedDate].[Date].[2017-06-30])

   MEMBER [ClosedDate].[Date].[MTD vs. Prev. MTD]          AS [ClosedDate].[Date].[MTD] - [ClosedDate].[Date].[PrevMTD]
   MEMBER [ClosedDate].[Date].[MTD vs. Prev. MTD %]        AS [ClosedDate].[Date].[MTD vs. Prev. MTD] / [ClosedDate].[Date].[MTD], FORMAT_STRING='Percent'
SELECT
   {
       [ClosedDate].[Date].[MTD],
       [ClosedDate].[Date].[PrevMTD],
       [ClosedDate].[Date].[MTD vs. Prev. MTD],
       [ClosedDate].[Date].[MTD vs. Prev. MTD %]
   } ON COLUMNS,
   NON EMPTY
   {
       [Measures].[ROH Count],
       [Measures].[ROH Total Sold Gross]
   } ON ROWS
FROM
   [ServiceDept]

ROH 計數行被正確格式化為整數,除了 MTD 與 Prev。MTD % 列,格式正確為百分比。

問題是 ROH Total Sold Gross 行,其中所有列都格式化為貨幣。

有沒有人做過這樣的事情?

在做了更多研究之後,我發現SOLVE_ORDER成員屬性可以SSAS使用MTD vs. Prev. MTD %成員的格式字元串。

以下程式碼對我有用:

MEMBER [ClosedDate].[Date].[MTD vs. Prev. MTD %] AS 
 [ClosedDate].[Date].[MTD vs. Prev. MTD] / [ClosedDate].[Date].[MTD],
 FORMAT_STRING='Percent', SOLVE_ORDER=1

引用自:https://dba.stackexchange.com/questions/183861