dbTalk Databases Forums  

Custom Aggregation in Calculated Measure (with Filter / Slicer)

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


Discuss Custom Aggregation in Calculated Measure (with Filter / Slicer) in the microsoft.public.sqlserver.olap forum.



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

Default Custom Aggregation in Calculated Measure (with Filter / Slicer) - 07-05-2006 , 06:07 AM






Hi all,



I would appreciate a hint on this probably pretty simple issue:



I have a calculated measure [Riscfactor] that is the minimum of measure
[Internal Risc] and measure [External Risk]. (both expressed as numeric
values, not normalized because they already include weights.)



[Riscfactor] is calculated on "Store"-Level and "Organization"- Level, with
store and organization building a hierarchie. (Each store belonging to one
organization)



On store level: [Riscfactor] = Max([Internal Risc], [External Risc])

On organization level [Riscfactor] = Sum of Riscfactors on store level



I used the following code:



CREATE MEMBER CURRENTCUBE.[MEASURES].[Riscfactor]

AS CASE

WHEN [OrgHierarchie].CURRENTMEMBER.LEVEL.NAME = "Store"

THEN IIF(

([Measures].[Internal Risc] < [Measures].[External Risc]),

[Measures].[External Risc]),

[Measures].[Internal Risc]

)

ELSE

SUM([OrgHierarchie].CURRENTMEMBER.Children,[MEASURES[Riscfactor])



That works fine, as long as I don't filter/slice on stores (e.g. in OWC or
Excel)



If I filter the resultset e.g. to display only two stores, the total for the
organization still is the total of all stores.

(Which actually is what I defined, by summing up all children of the current
member.)

Anyway, I am looking for a solution, that limits the total to only those
children, that are selected. (Something like CURRENTMEMBER.CURRENTChildren)



Any help or ideas will be very much appreciated



John




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

Default Re: Custom Aggregation in Calculated Measure (with Filter / Slicer) - 08-08-2006 , 07:00 PM






You can use Filter with existing within sum function for example, i guest.

Regards,
Mariana.

"bjh" <nospam (AT) webtelligence (DOT) net> wrote

Quote:
Hi all,



I would appreciate a hint on this probably pretty simple issue:



I have a calculated measure [Riscfactor] that is the minimum of measure
[Internal Risc] and measure [External Risk]. (both expressed as numeric
values, not normalized because they already include weights.)



[Riscfactor] is calculated on "Store"-Level and "Organization"- Level,
with store and organization building a hierarchie. (Each store belonging
to one organization)



On store level: [Riscfactor] = Max([Internal Risc], [External Risc])

On organization level [Riscfactor] = Sum of Riscfactors on store level



I used the following code:



CREATE MEMBER CURRENTCUBE.[MEASURES].[Riscfactor]

AS CASE

WHEN [OrgHierarchie].CURRENTMEMBER.LEVEL.NAME = "Store"

THEN IIF(

([Measures].[Internal Risc] < [Measures].[External Risc]),

[Measures].[External Risc]),

[Measures].[Internal Risc]

)

ELSE

SUM([OrgHierarchie].CURRENTMEMBER.Children,[MEASURES[Riscfactor])



That works fine, as long as I don't filter/slice on stores (e.g. in OWC or
Excel)



If I filter the resultset e.g. to display only two stores, the total for
the organization still is the total of all stores.

(Which actually is what I defined, by summing up all children of the
current member.)

Anyway, I am looking for a solution, that limits the total to only those
children, that are selected. (Something like
CURRENTMEMBER.CURRENTChildren)



Any help or ideas will be very much appreciated



John






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.