![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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? |
#3
| |||
| |||
|
|
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? |
#4
| |||
| |||
|
|
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. |
#5
| |||
| |||
|
|
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. |
#6
| |||
| |||
|
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
| |