dbTalk Databases Forums  

Derived measures and distinct count

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


Discuss Derived measures and distinct count in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
tarana halsall via SQLMonster.com
 
Posts: n/a

Default Derived measures and distinct count - 01-09-2005 , 03:21 AM






Data looks like this. Products are sold and each sale may be associated with a promotion. The promotion scheme is not constant for a product and can be used across a product

Fact -
SKU Id, Promotion Id
x , null (not associated with a promotion)
y , 1
z , 2
a , 1

Dimension - SKU
Product Id
SKU Id
members are
1001,x
1001,y
1001,z
1002,a


The counts i needs are
number of products (distinct count) - here 2
number of promoted products - here 2
number of non promoted product - here 1

The product 1001 will appear in the promoted as well as non promoted count.

I am able get the first by just setting up a distinct count with the source as the product ID from the SKU dimension table

Can some one help me do the other two please. I am working with Yukon, and looks like we are not allowed to use an iif in the measure expression to create a derived measure. Even if I were, i am not sure how to pass the results to a distinct count, as a distinct count counts nulls also.

thanks very much

--
Message posted via http://www.sqlmonster.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.