dbTalk Databases Forums  

MDX : using YTD for a weighted average measure

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


Discuss MDX : using YTD for a weighted average measure in the microsoft.public.sqlserver.olap forum.



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

Default MDX : using YTD for a weighted average measure - 09-12-2005 , 05:38 AM






I searched the internet for a YTD example where a weighted average is used.

I have defined a calculated cell Measure.CC in a cube as ( Measure A +
Measure B / Measure C ).
I've seen multiple examples where the YTD sum is calculated like this:

with
Member [Measures].[CC YTD] AS
'Sum( PeriodstoDate( [Time].[Year] ), [Measures].[CC]) '
Select
{
[Measures].[CC], [Measures].[CC YTD]
} on columns,
[Time].[Month].members on Rows

I don't want sum or average, I just want to evaluate the caculated cell (a
+ b/c) as a weighted YTD average.
Is this possible?


Reply With Quote
  #2  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: MDX : using YTD for a weighted average measure - 09-12-2005 , 06:25 AM






MDX is pretty powerful. If you can explain how you want to the weighting
to work (what the formula should be) someone might be able to come up
with exactly what you are looking for.

--
Regards
Darren Gosbell [MCSD]
<dgosbell_at_yahoo_dot_com>
Blog: http://www.geekswithblogs.net/darrengosbell

In article <E30FA689-7CDF-40C8-BB44-56B9F1A0CED8 (AT) microsoft (DOT) com>,
David (AT) discussions (DOT) microsoft.com says...
Quote:
I searched the internet for a YTD example where a weighted average is used.

I have defined a calculated cell Measure.CC in a cube as ( Measure A +
Measure B / Measure C ).
I've seen multiple examples where the YTD sum is calculated like this:

with
Member [Measures].[CC YTD] AS
'Sum( PeriodstoDate( [Time].[Year] ), [Measures].[CC]) '
Select
{
[Measures].[CC], [Measures].[CC YTD]
} on columns,
[Time].[Month].members on Rows

I don't want sum or average, I just want to evaluate the caculated cell (a
+ b/c) as a weighted YTD average.
Is this possible?



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

Default Re: MDX : using YTD for a weighted average measure - 09-12-2005 , 06:43 AM



When using 'Sum( PeriodstoDate( [Time].[Year] ), [Measures].[CC]) '
the result of A + B /C is being summed at all Time.month.members,
but is should sum ( A ) + Sum ( B ) / Sum (C) instead.
( If i could write something like:
with
Member [Measures].[CC YTD] AS
' PeriodstoDate( [Time].[Year] ), [Measures].[CC] '
without the sum)


The problem is, I could write this in MDX, but only [Measures].[CC] is
passed from the business tier in my application. And i do not know
the calculation contents of [Measures].[CC] without consulting it in
analysis manager.

--
Working on windows2000 with Websphere Developement Studio Client for
iSeries... and having hard times


"Darren Gosbell" wrote:

Quote:
MDX is pretty powerful. If you can explain how you want to the weighting
to work (what the formula should be) someone might be able to come up
with exactly what you are looking for.

--
Regards
Darren Gosbell [MCSD]
dgosbell_at_yahoo_dot_com
Blog: http://www.geekswithblogs.net/darrengosbell

In article <E30FA689-7CDF-40C8-BB44-56B9F1A0CED8 (AT) microsoft (DOT) com>,
David (AT) discussions (DOT) microsoft.com says...
I searched the internet for a YTD example where a weighted average is used.

I have defined a calculated cell Measure.CC in a cube as ( Measure A +
Measure B / Measure C ).
I've seen multiple examples where the YTD sum is calculated like this:

with
Member [Measures].[CC YTD] AS
'Sum( PeriodstoDate( [Time].[Year] ), [Measures].[CC]) '
Select
{
[Measures].[CC], [Measures].[CC YTD]
} on columns,
[Time].[Month].members on Rows

I don't want sum or average, I just want to evaluate the caculated cell (a
+ b/c) as a weighted YTD average.
Is this possible?




Reply With Quote
  #4  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: MDX : using YTD for a weighted average measure - 09-12-2005 , 07:51 PM



I'm not entirely sure I understand the issue with the business tier. So
you may have already tried this, but have you tried creating 4
calculated measures instead of trying to do it all in one?

eg. create
[YTD A] as Sum(PeriodstoDate( [Time].[Year] ), [Measures].[A])
[YTD B] as Sum(PeriodstoDate( [Time].[Year] ), [Measures].[b])
[YTD C] as Sum(PeriodstoDate( [Time].[Year] ), [Measures].[C])

and then

[YTD CC] = [YTD A] + [YTD B] / [YTD C]

if you like you should be able to mark the 3 base YTD calculations as
not visible so that they do not appear to the end users.

If you have already tried this approach you may be able to use a dummy
measure and calculated cells.

--
Regards
Darren Gosbell [MCSD]
<dgosbell_at_yahoo_dot_com>
Blog: http://www.geekswithblogs.net/darrengosbell

In article <67489130-DB2D-499C-8EB7-481634F84080 (AT) microsoft (DOT) com>,
David (AT) discussions (DOT) microsoft.com says...
Quote:
When using 'Sum( PeriodstoDate( [Time].[Year] ), [Measures].[CC]) '
the result of A + B /C is being summed at all Time.month.members,
but is should sum ( A ) + Sum ( B ) / Sum (C) instead.
( If i could write something like:
with
Member [Measures].[CC YTD] AS
' PeriodstoDate( [Time].[Year] ), [Measures].[CC] '
without the sum)


The problem is, I could write this in MDX, but only [Measures].[CC] is
passed from the business tier in my application. And i do not know
the calculation contents of [Measures].[CC] without consulting it in
analysis manager.




Reply With Quote
  #5  
Old   
David
 
Posts: n/a

Default Re: MDX : using YTD for a weighted average measure - 09-13-2005 , 01:33 AM



thanx for your reply.

The thing with the business tier is quite simple:
The business tier passes three slices to me ( measure, some dimension slice
and a time slice)
These three slices are used to build a query in this form:
with
measure [Measures].[<Measurename> + YTD]
' ... some expression ... '
select
[Measures].[<Measurename>], [Measures].[<Measurename> + YTD] on rows,
<time slices> on columns
where ( < some dimension> )

Because of this, i do not know the calculation of a measure in case of
calculated members. Normally when dealing with caculated measures using a
a+b/c form, these calculated measures are aggregated normally in the cube (
which means: sum(a) + sum(b) / sum(c) will be evaluated at each level of the
cube.
If i want to know the value of the CC ( calculated cell ) at some level, i
do not have to do a sum(a) + sum(b) / sum(c) cause this is automatically
calculated in the cube.
Now I want this same behavior for only the months within the YTD-set.
Is this possible?







--


"Darren Gosbell" wrote:

Quote:
I'm not entirely sure I understand the issue with the business tier. So
you may have already tried this, but have you tried creating 4
calculated measures instead of trying to do it all in one?

eg. create
[YTD A] as Sum(PeriodstoDate( [Time].[Year] ), [Measures].[A])
[YTD B] as Sum(PeriodstoDate( [Time].[Year] ), [Measures].[b])
[YTD C] as Sum(PeriodstoDate( [Time].[Year] ), [Measures].[C])

and then

[YTD CC] = [YTD A] + [YTD B] / [YTD C]

if you like you should be able to mark the 3 base YTD calculations as
not visible so that they do not appear to the end users.

If you have already tried this approach you may be able to use a dummy
measure and calculated cells.

--
Regards
Darren Gosbell [MCSD]
dgosbell_at_yahoo_dot_com
Blog: http://www.geekswithblogs.net/darrengosbell

In article <67489130-DB2D-499C-8EB7-481634F84080 (AT) microsoft (DOT) com>,
David (AT) discussions (DOT) microsoft.com says...
When using 'Sum( PeriodstoDate( [Time].[Year] ), [Measures].[CC]) '
the result of A + B /C is being summed at all Time.month.members,
but is should sum ( A ) + Sum ( B ) / Sum (C) instead.
( If i could write something like:
with
Member [Measures].[CC YTD] AS
' PeriodstoDate( [Time].[Year] ), [Measures].[CC] '
without the sum)


The problem is, I could write this in MDX, but only [Measures].[CC] is
passed from the business tier in my application. And i do not know
the calculation contents of [Measures].[CC] without consulting it in
analysis manager.





Reply With Quote
  #6  
Old   
David
 
Posts: n/a

Default Re: MDX : using YTD for a weighted average measure - 09-16-2005 , 03:50 AM



Allright,
this is my solution at the moment. PRoblem is, i have to create the query
for each month.

with member
[Time].[Try] as
' Aggregate( PeriodsToDate([Time].[Year] ,[Time].[All
Time].[2005].[Quarter 3].[August] ) )'
select
{ [Measures].[CC]
} on columns,
{ [Time].[Try]
} on rows
From Cube

--
Working on windows2000 with Websphere Developement Studio Client for
iSeries... and having hard times


"David" wrote:

Quote:
thanx for your reply.

The thing with the business tier is quite simple:
The business tier passes three slices to me ( measure, some dimension slice
and a time slice)
These three slices are used to build a query in this form:
with
measure [Measures].[<Measurename> + YTD]
' ... some expression ... '
select
[Measures].[<Measurename>], [Measures].[<Measurename> + YTD] on rows,
time slices> on columns
where ( < some dimension> )

Because of this, i do not know the calculation of a measure in case of
calculated members. Normally when dealing with caculated measures using a
a+b/c form, these calculated measures are aggregated normally in the cube (
which means: sum(a) + sum(b) / sum(c) will be evaluated at each level of the
cube.
If i want to know the value of the CC ( calculated cell ) at some level, i
do not have to do a sum(a) + sum(b) / sum(c) cause this is automatically
calculated in the cube.
Now I want this same behavior for only the months within the YTD-set.
Is this possible?







--


"Darren Gosbell" wrote:

I'm not entirely sure I understand the issue with the business tier. So
you may have already tried this, but have you tried creating 4
calculated measures instead of trying to do it all in one?

eg. create
[YTD A] as Sum(PeriodstoDate( [Time].[Year] ), [Measures].[A])
[YTD B] as Sum(PeriodstoDate( [Time].[Year] ), [Measures].[b])
[YTD C] as Sum(PeriodstoDate( [Time].[Year] ), [Measures].[C])

and then

[YTD CC] = [YTD A] + [YTD B] / [YTD C]

if you like you should be able to mark the 3 base YTD calculations as
not visible so that they do not appear to the end users.

If you have already tried this approach you may be able to use a dummy
measure and calculated cells.

--
Regards
Darren Gosbell [MCSD]
dgosbell_at_yahoo_dot_com
Blog: http://www.geekswithblogs.net/darrengosbell

In article <67489130-DB2D-499C-8EB7-481634F84080 (AT) microsoft (DOT) com>,
David (AT) discussions (DOT) microsoft.com says...
When using 'Sum( PeriodstoDate( [Time].[Year] ), [Measures].[CC]) '
the result of A + B /C is being summed at all Time.month.members,
but is should sum ( A ) + Sum ( B ) / Sum (C) instead.
( If i could write something like:
with
Member [Measures].[CC YTD] AS
' PeriodstoDate( [Time].[Year] ), [Measures].[CC] '
without the sum)


The problem is, I could write this in MDX, but only [Measures].[CC] is
passed from the business tier in my application. And i do not know
the calculation contents of [Measures].[CC] without consulting it in
analysis manager.





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.