dbTalk Databases Forums  

Distinct count

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


Discuss Distinct count in the microsoft.public.sqlserver.olap forum.



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

Default Distinct count - 10-11-2005 , 01:39 AM






how would I expand this to work with other dimensions ?

want it to work with my time dimension as well.

COUNT(CROSSJOIN({[MEASURES].[Amount Dkkcurr]},

DESCENDANTS([T_No].CURRENTMEMBER,

[T_No].[T No])), EXCLUDEEMPTY)







Reply With Quote
  #2  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: Distinct count - 10-11-2005 , 05:16 AM






You would need to add the time demension to the crossjoin that you are
counting. This will obvious slow down the calculation a bit.

COUNT(CROSSJOIN({[MEASURES].[Amount Dkkcurr]},
DESCENDANTS([T_No].CURRENTMEMBER,
[T_No].[T No])
DESCENDANTS([Time].CURRENTMEMBER,
[Time].[Month])
), EXCLUDEEMPTY)

--
Regards
Darren Gosbell [MCSD]
<dgosbell_at_yahoo_dot_com>
Blog: http://www.geekswithblogs.net/darrengosbell

Reply With Quote
  #3  
Old   
michael v
 
Posts: n/a

Default Re: Distinct count - 10-12-2005 , 03:31 AM



thanx for the input. However I simply cannot seem to get it right

Tried this

COUNT(CROSSJOIN({[MEASURES].[Amount Dkkcurr]},

DESCENDANTS([T_No].CURRENTMEMBER,

[T_No].[T No]),DESCENDANTS([Due Date].CURRENTMEMBER,

[Due Date].members)) EXCLUDEEMPTY)

and this:

COUNT(CROSSJOIN({[MEASURES].[Amount Dkkcurr]},

DESCENDANTS([T_No].CURRENTMEMBER,

[T_No].[T No]),DESCENDANTS([Due Date].CURRENTMEMBER,

[Due Date].[Year])) EXCLUDEEMPTY)


"Darren Gosbell" <xxx (AT) xxx (DOT) com> wrote

Quote:
You would need to add the time demension to the crossjoin that you are
counting. This will obvious slow down the calculation a bit.

COUNT(CROSSJOIN({[MEASURES].[Amount Dkkcurr]},
DESCENDANTS([T_No].CURRENTMEMBER,
[T_No].[T No])
DESCENDANTS([Time].CURRENTMEMBER,
[Time].[Month])
), EXCLUDEEMPTY)

--
Regards
Darren Gosbell [MCSD]
dgosbell_at_yahoo_dot_com
Blog: http://www.geekswithblogs.net/darrengosbell



Reply With Quote
  #4  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: Distinct count - 10-12-2005 , 06:32 AM




Quote:
thanx for the input. However I simply cannot seem to get it right
I assume you are getting syntax errors?

I'm sorry about that, when I translated the calculation from using the
foodmart database to using your dimensions and measures I accidentally
left off a nested crossjoin.

The crossjoin() function can only take 2 sets as arguments so in order
to join more than 2 sets you need to crossjoin them.

see if this works, I have indented it to help line up the functions so
hopefully this one will work.

COUNT(
CROSSJOIN(
CROSSJOIN(
{[MEASURES].[Amount Dkkcurr]}
,DESCENDANTS([T_No].CURRENTMEMBER, [T_No].[T No])
)
, DESCENDANTS([Due Date].CURRENTMEMBER, [Due Date].[Year])
)
, EXCLUDEEMPTY)


--
Regards
Darren Gosbell [MCSD]
<dgosbell_at_yahoo_dot_com>
Blog: http://www.geekswithblogs.net/darrengosbell


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.