dbTalk Databases Forums  

Calculated Measure Total

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


Discuss Calculated Measure Total in the microsoft.public.sqlserver.olap forum.



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

Default Calculated Measure Total - 08-02-2006 , 04:11 PM






I have a calculated measure performing some mathematical equations to the data.

Basically the results are something like

ColumnA ColumnB CalculatedTotal
2,000,000 160,000 .7
2,500,000 190,000 .8
=========
.12
The problem is that it appears that the calculated measure sums the data
before doing the calculations resulting in a wrong value (or at least not
what I want).
What I want is to have an AVERAGE for the rollup and get a result of .75 in
this case. Is there a way to override this behavior?


Reply With Quote
  #2  
Old   
Mariana
 
Posts: n/a

Default Re: Calculated Measure Total - 08-02-2006 , 05:51 PM






Hi steve,
which is the formula that u are using? did u use SOLVE_ORDER ?

"SteveM" <SteveM (AT) discussions (DOT) microsoft.com> wrote

Quote:
I have a calculated measure performing some mathematical equations to the
data.

Basically the results are something like

ColumnA ColumnB CalculatedTotal
2,000,000 160,000 .7
2,500,000 190,000 .8
=========
.12
The problem is that it appears that the calculated measure sums the data
before doing the calculations resulting in a wrong value (or at least not
what I want).
What I want is to have an AVERAGE for the rollup and get a result of .75
in
this case. Is there a way to override this behavior?




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

Default Re: Calculated Measure Total - 08-02-2006 , 10:32 PM



I looked at that, but I don't think it solves my problem.

I think what is complicating this is that the values in "A" and "B" columns
below are treated differently based upon a dimension with account types. Some
members are percentages, others Last child, others are summed.

However, once the calculated total is created , I want these to simply
average.

The calculated measure is below. It references a couple of other measures,
but it is working for the details. However, it gives the wrong answer for the
total.

IIF ( ISEMPTY([Measures].[WarningN]) OR ISEMPTY([Measures].[ValueN]) OR
ISEMPTY([Measures].[TargetN])
,
NULL,
Case
When [Measures].[WarningN] = [Measures].[ValueN] then .75
When [Measures].[WarningN] < [Measures].[TargetN] then
case when [Measures].[ValueN] > [Measures].[WarningN]
then (.75 + (( [Measures].[ValueN] - [Measures].[WarningN]) /
(([Measures].[TargetN] - [Measures].[WarningN])*10)))
else (.75 - (( [Measures].[WarningN] - [Measures].[ValueN]) /
(([Measures].[TargetN] - [Measures].[WarningN])*10)))
end
else
case when [Measures].[ValueN] > [Measures].[WarningN]
then (.75 - (( [Measures].[ValueN] - [Measures].[WarningN] ) /
(([Measures].[WarningN] - [Measures].[TargetN])*10)))
else (.75 + (( [Measures].[WarningN] - [Measures].[ValueN] ) /
(([Measures].[WarningN] - [Measures].[TargetN])*10)))
end
end)




"Mariana" wrote:

Quote:
Hi steve,
which is the formula that u are using? did u use SOLVE_ORDER ?

"SteveM" <SteveM (AT) discussions (DOT) microsoft.com> wrote in message
news:37038290-968C-4869-8DE3-574E150414FC (AT) microsoft (DOT) com...
I have a calculated measure performing some mathematical equations to the
data.

Basically the results are something like

ColumnA ColumnB CalculatedTotal
2,000,000 160,000 .7
2,500,000 190,000 .8
=========
.12
The problem is that it appears that the calculated measure sums the data
before doing the calculations resulting in a wrong value (or at least not
what I want).
What I want is to have an AVERAGE for the rollup and get a result of .75
in
this case. Is there a way to override this behavior?





Reply With Quote
  #4  
Old   
Mariana
 
Posts: n/a

Default Re: Calculated Measure Total - 08-03-2006 , 01:27 PM



I think that u must ask for isleaf(dimension1.currentmember.children) for
each dimension with "AND" operator and then it's a leaf use your formula, if
not u must use something like this:
avg(dimension1.currentmember.children,dimension2.c urrentmember.children,...,Measures.CalculatedTotal )
(autorefering)

"SteveM" <SteveM (AT) discussions (DOT) microsoft.com> wrote

Quote:
I looked at that, but I don't think it solves my problem.

I think what is complicating this is that the values in "A" and "B"
columns
below are treated differently based upon a dimension with account types.
Some
members are percentages, others Last child, others are summed.

However, once the calculated total is created , I want these to simply
average.

The calculated measure is below. It references a couple of other measures,
but it is working for the details. However, it gives the wrong answer for
the
total.

IIF ( ISEMPTY([Measures].[WarningN]) OR ISEMPTY([Measures].[ValueN]) OR
ISEMPTY([Measures].[TargetN])
,
NULL,
Case
When [Measures].[WarningN] = [Measures].[ValueN] then .75
When [Measures].[WarningN] < [Measures].[TargetN] then
case when [Measures].[ValueN] > [Measures].[WarningN]
then (.75 + (( [Measures].[ValueN] - [Measures].[WarningN]) /
(([Measures].[TargetN] - [Measures].[WarningN])*10)))
else (.75 - (( [Measures].[WarningN] - [Measures].[ValueN]) /
(([Measures].[TargetN] - [Measures].[WarningN])*10)))
end
else
case when [Measures].[ValueN] > [Measures].[WarningN]
then (.75 - (( [Measures].[ValueN] - [Measures].[WarningN] ) /
(([Measures].[WarningN] - [Measures].[TargetN])*10)))
else (.75 + (( [Measures].[WarningN] - [Measures].[ValueN] ) /
(([Measures].[WarningN] - [Measures].[TargetN])*10)))
end
end)




"Mariana" wrote:

Hi steve,
which is the formula that u are using? did u use SOLVE_ORDER ?

"SteveM" <SteveM (AT) discussions (DOT) microsoft.com> wrote in message
news:37038290-968C-4869-8DE3-574E150414FC (AT) microsoft (DOT) com...
I have a calculated measure performing some mathematical equations to
the
data.

Basically the results are something like

ColumnA ColumnB CalculatedTotal
2,000,000 160,000 .7
2,500,000 190,000 .8
=========
.12
The problem is that it appears that the calculated measure sums the
data
before doing the calculations resulting in a wrong value (or at least
not
what I want).
What I want is to have an AVERAGE for the rollup and get a result of
.75
in
this case. Is there a way to override this behavior?







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.