舍入计算MDX上的值

时间:2016-08-23 08:25:38

标签: mdx

我有Tableau生成的MDX查询到OLAP多维数据集:

WITH MEMBER [Measures].[Average] AS [Measures].[Summary Value]/[Measures].[Quantity SUM] 

SELECT NON EMPTY { [Measures].[Quantity SUM], [Measures].[Summary Value],  [Measures].[Average] } ON COLUMNS, NON EMPTY { ([Waiter].[WaiterName].[WaiterName].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM [ProductCube] CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

问题在于计算值 - 'Avarage'。如何将此值舍入到两位小数?

2 个答案:

答案 0 :(得分:1)

你可以试试这个:

WITH MEMBER [Measures].[Average] AS [Measures].[Summary Value]/[Measures].[Quantity SUM] 
,FORMAT_STRING="#0.00"
SELECT
    (...)

答案 1 :(得分:0)

要强制执行此过程,您可以尝试以下操作:

WITH 
  MEMBER testvalue AS 
    VBA!Round
    (0.57372843213
     ,2
    ) 
SELECT 
  {[Measures].[testvalue]} ON 0
FROM [Adventure Works];

虽然我不确定Tableau是否支持此功能。