kenzolek
kenzolek

Reputation: 344

Rounding calculate value on MDX

I have MDX query generated by Tableau to OLAP cube:

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

The problem is with calculated value - 'Avarage'. How can I round this value to two decimal places?

Upvotes: 0

Views: 1241

Answers (2)

whytheq
whytheq

Reputation: 35557

To force the process you could try this:

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

Although I'm unsure if this function will be supported in Tableau.

Upvotes: 0

mxix
mxix

Reputation: 3659

Can you try this:

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

Upvotes: 1

Related Questions