dbTalk Databases Forums  

crossjoin calculated member help

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


Discuss crossjoin calculated member help in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
hulst.j@chello.nl
 
Posts: n/a

Default crossjoin calculated member help - 08-28-2003 , 12:30 PM






I want to have the avg days worked for all the drivers in a specific
period.

The first calculated member works, but calculates the avg over all
members:

Avg(Descendants([drivers].currentmember,[drivers].[Rel Nr]),
[Measures].[Dagen])

Then I thought that a nonemptycrossjoin would do the job: count all
the members that have a value in the period and take the average of
that. The sybtax is ok but the run time produces an error


avg(NonEmptyCrossJoin(Descendants([drivers].currentmember,
[drivers].[Rel Nr]), [kalender].currentmember) ,[Measures].[Dagen])

Even the MDX solutions by George Spofford does not give a clue to
this

Can someone help me?



Thanks in advance





Reply With Quote
  #2  
Old   
Mosha Pasumansky [MS]
 
Posts: n/a

Default Re: crossjoin calculated member help - 08-31-2003 , 11:35 PM






<hulst.j (AT) chello (DOT) nl> wrote

Quote:
I want to have the avg days worked for all the drivers in a specific
period.

The first calculated member works, but calculates the avg over all
members:

Avg(Descendants([drivers].currentmember,[drivers].[Rel Nr]),
[Measures].[Dagen])

Then I thought that a nonemptycrossjoin would do the job: count all
the members that have a value in the period and take the average of
that. The sybtax is ok but the run time produces an error

avg(NonEmptyCrossJoin(Descendants([drivers].currentmember,
[drivers].[Rel Nr]), [kalender].currentmember) ,[Measures].[Dagen])

Even the MDX solutions by George Spofford does not give a clue to
this

Can someone help me?

Thanks in advance
Hi

You don't need to put NonEmptyCrossJoin around set in average, because
average will automatically not count members without data.
I assume that [Measures].[Dagen] is the number of days worked. The average
across all drivers will be

Avg([drivers].[Rel Nr].members, measures.dagen)

If you want to see it for specific time period, you need to slice in your
query on that period.
Or if you wanted to hardcode it on one period, you could do

Avg([drivers].[Rel Nr].members, (measures.dagen,kalendar.[Aug 7 2003]))

HTH,
Mosha

--
==================================================
Mosha Pasumansky - www.mosha.com/msolap
Development Lead in the Analysis Server team
All you need is love (John Lennon)
Disclaimer : This posting is provided "AS IS" with no warranties, and
confers no rights.
==================================================




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.