Showing posts with label SSAS. Show all posts
Showing posts with label SSAS. Show all posts

Tuesday, March 6, 2012

Average of Dimension attribute value

Query to find out the average of a value that is an attribute in the dimension.


WITH
MEMBER [Measures].[Average Cars Owned] As
      Avg(
            DESCENDANTS(
                  [Customer].[Customer Geography].CURRENTMEMBER,
                  [Customer].[Customer Geography].[Customer]
            )AS Set1,
            StrToValue(Set1.Current.Properties("Number of Cars Owned"))
      )
     
SELECT
    {
            [Measures].[Average Cars Owned]
    } ON COLUMNS,
    DESCENDANTS(
    [Customer].[Customer Geography].CURRENTMEMBER,
    [Customer].[Customer Geography].[State-Province],SELF_AND_BEFORE)
     ON ROWS
FROM
   [Adventure Works]
where
[Customer].[Country].&[Australia]

LinkWithin

Related Posts with Thumbnails