dbTalk Databases Forums  

Sum problem in parent-child dimension

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


Discuss Sum problem in parent-child dimension in the microsoft.public.sqlserver.olap forum.



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

Default Sum problem in parent-child dimension - 09-21-2006 , 10:03 AM






Hi,

I'm trying to sum a measure at a parent level based on a filter applied on
the child level. I haven't been using MDX very long so I'd really appreciate
help on this. This query returns the set I'd like to sum :

with member [measures].[poncho] as ([dim
product].[produits].currentmember.properties("poncho",typed))
set [poncho] as filter([dim product].[produits].[semences].[mais
elite].[mais hte].[4066].children,[measures].[poncho] = false and
[measures].[dollars] > 1 )
select ([measures].[dollars]) on 0,
[poncho] on 1
from phytosource

I tried to sum() on the named set but I always get :The function expects a
tuple set expression for the argument. A string or numeric expression was
used.

I also tried to filter with a sub cube but the member is not valid in it...



thanks

Fred

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

Default Re: Sum problem in parent-child dimension - 09-21-2006 , 12:43 PM






Based on your problem description, the [poncho] named set looks like a
specific example of what you want in general, for members of the [dim
product].[produits] hierarchy. Does a calculated measure like this work
for you?

Quote:
with member [measures].[poncho] as
[dim product].[produits].properties("poncho",typed)

member [measures].[sumponcho] as
sum(filter([dim product].[produits].children,
[measures].[poncho] = false and [measures].[dollars] > 1),
[measures].[dollars])

select {[measures].[dollars], [measures].[sumponcho]} on 0,
{[dim product].[produits].[semences].[mais elite].[mais hte].[4066]} on
1
from phytosource
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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


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

Default Re: Sum problem in parent-child dimension - 09-21-2006 , 12:58 PM



Thanks a lot....this is exactlly what I wanted!

Fred

"Deepak Puri" wrote:

Quote:
Based on your problem description, the [poncho] named set looks like a
specific example of what you want in general, for members of the [dim
product].[produits] hierarchy. Does a calculated measure like this work
for you?


with member [measures].[poncho] as
[dim product].[produits].properties("poncho",typed)

member [measures].[sumponcho] as
sum(filter([dim product].[produits].children,
[measures].[poncho] = false and [measures].[dollars] > 1),
[measures].[dollars])

select {[measures].[dollars], [measures].[sumponcho]} on 0,
{[dim product].[produits].[semences].[mais elite].[mais hte].[4066]} on
1
from phytosource



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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


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.