dbTalk Databases Forums  

Percent of base in AS

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Percent of base in AS in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
David Hines
 
Posts: n/a

Default Percent of base in AS - 04-05-2005 , 09:37 AM






Hi all,
does anyone know how it is possible to include the percent of base
calculated measure in a cube in analysis services. I have a measure that I
need to know what percentage it is of the grand total. I know little about
MDX and was wondering if tis possible.

Thanks
Dave

Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Percent of base in AS - 04-05-2005 , 04:01 PM






Not sure what the desired report is, but does this MDX sample query come
close to what you want?

http://www.tomchester.net/articlesdo...desamples.html
Quote:
Flexible Percent of Total

Works with any set and any measure (assumes measure being operated upon
is in first column)

WITH MEMBER Measures.[% Total] AS

' ( StrToSet("Axis(1)").Item(0).Item(0).Dimension.Curr entMember, --
cur row mbr

StrToSet("Axis(0)").Item(0).Item(0) ) / --
1st measure on cols

( StrToSet("Axis(1)").Item(0).Item(0), --
assume 1st row=total

StrToSet("Axis(0)").Item(0).Item(0) ) ' , --
1st measure on cols

Format_String = '0%'

SELECT

{ [Store Sales] , [% Total] } ON AXIS(0),

{ Product.DefaultMember, [Product Family].Members} ON AXIS(1)

FROM Sales
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #3  
Old   
David Hines
 
Posts: n/a

Default Re: Percent of base in AS - 04-06-2005 , 03:27 AM





"Deepak Puri" wrote:

Quote:
Not sure what the desired report is, but does this MDX sample query come
close to what you want?

http://www.tomchester.net/articlesdo...desamples.html

Flexible Percent of Total

Works with any set and any measure (assumes measure being operated upon
is in first column)

WITH MEMBER Measures.[% Total] AS

' ( StrToSet("Axis(1)").Item(0).Item(0).Dimension.Curr entMember, --
cur row mbr

StrToSet("Axis(0)").Item(0).Item(0) ) / --
1st measure on cols

( StrToSet("Axis(1)").Item(0).Item(0), --
assume 1st row=total

StrToSet("Axis(0)").Item(0).Item(0) ) ' , --
1st measure on cols

Format_String = '0%'

SELECT

{ [Store Sales] , [% Total] } ON AXIS(0),

{ Product.DefaultMember, [Product Family].Members} ON AXIS(1)

FROM Sales



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***

Thanks Deepak I'll try this first thing in the morning.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.