SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 
        
Home       Members    Calendar    Who's On



Use Average (or other) MDX Function on Dimension Field Expand / Collapse
Author
Message
Posted Friday, November 06, 2009 3:59 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Wednesday, November 11, 2009 5:12 PM
Points: 805, Visits: 238
I have a dimension called position (a numeric field), which is sometimes used to cut by.
But in this situation, I want the average position for a time period.
Is it possible to use the average function on a dimension field (as opposed to a measure)?
If so, please help.

For Example, this pulls data:

WITH

MEMBER [Measures].[Position] as [Dim Position].[Dim Position].currentmember.name
MEMBER [Measures].[Avg Position] as AVG([Hotel].[Hotel Key].currentmember,[Measures].[Position])

SELECT
({
[Measures].[RecordCount],
[Measures].[Position],
[Measures].[Avg Position]
}) ON COLUMNS ,

filter((
[Date].[Calendar].[Date].&[2009-10-16T00:00:00]
,nonempty([Hotel].[Hotel Key].[Hotel Key])
,[Position].[Dim Position].children
)
,[Measures].[RecordCount]>0)
ON ROWS

FROM [Lodging]

BUT it gives the average position for each position - which, obviously, is not helpful
I want the average position for each hotel.

I want to remove the ,[Position].[Dim Position].children line from Rows, but then the MDX doesn't work.

Any suggestions greatly appreciated.
Thank you, Megan



Post #815236
« Prev Topic | Next Topic »


Permissions Expand / Collapse