Quantcast
Channel: SQL Server Analysis Services Forum
Viewing all articles
Browse latest Browse all 2472

Need help with MDX query ...

$
0
0

I have the below MDX query from which i have the attached Dataset result ..Is there any way to get a  new row with value as Australia under State and sum up all the state values for those month in the attached resultset...Thanks in advance

WITH

MEMBER [Measures].[Month_to_Show] AS  CASE WHEN [Date].[YQM].CURRENTMEMBER.MEMBER_CAPTION = "2011" THEN "2011 AVERAGE" ELSE [Date].[YQM].CURRENTMEMBER.MEMBER_CAPTION END

MEMBER [Measures].[Year_2011_AvgUnits] AS SUM([Date].[YQM].[Year].&[2011],[Measures].[Exf Units])/10

MEMBER [Measures].[Share] AS CASE WHEN [Date].[YQM].CURRENTMEMBER.MEMBER_CAPTION = "2011" THEN  1 ELSE [Measures].[Exf Units]/[Measures].[Year_2011_AvgUnits]  END

MEMBER [Measures].[Units] AS CASE WHEN [Date].[YQM].CURRENTMEMBER.MEMBER_CAPTION = "2011" THEN [Measures].[Year_2011_AvgUnits] ELSE [Measures].[Exf Units] END


SELECT
NON EMPTY {  [Measures].[Month_to_Show],  
[Measures].[Units],
[Measures].[Share],
[MEASURES].[Year_2011_AvgUnits]  } ON COLUMNS,

NON EMPTY (  {[Date].[YQM].[Year].&[2011], [Date].[YQM].[Month]} ) ON ROWS,

{[Product].[Product Name].[Product Name]* [Account].[Ora Acct State].[Ora Acct State] } ON PAGES

FROM (SELECT   ( {strtoset(@Year),[Date].[YQM].[Year].&[2011]}, strtoset(@Product)) ON COLUMNS FROM [CUBE]

Product NameStateYrQtrMnthMnth to showUnitsShareYear_2011_avgunits
TESTNSW2011nullNULL2011 year average100011000
TESTNSW2011qtr1Jan-11January5160.531000
TESTNSW2011qtr1Feb-11Febuary6600.671000
TESTNSW2011qtr1Mar-11march7290.751000
TESTNSW2011qtr2Apr-11april8030.751000
TESTNSW2011qtr2Jun-11May8040.821000
TESTNSW2011qtr2Jul-11June8290.851000



Viewing all articles
Browse latest Browse all 2472

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>