dbTalk Databases Forums  

How do I count non-null values?

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


Discuss How do I count non-null values? in the microsoft.public.sqlserver.olap forum.



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

Default How do I count non-null values? - 01-23-2004 , 12:41 PM






I am creating a cube for one of our fact tables. (ORDER)
If one of the date columns (DeliveryDate) is Non-Null I need to count the
record.
(Basically, I need to count the number of ORDER table records that have non
null in the DeliveryDate column).

I know how to create some standard Measures and Dimensions in a Cube.
Howver, could someone give me the broad steps involved in creating the above
Measure of counting the nonnull DeliveryDate values.

Thanks,
S.Kumar



Reply With Quote
  #2  
Old   
Martin Mason
 
Posts: n/a

Default Re: How do I count non-null values? - 01-24-2004 , 06:42 AM






Create a view on the relational side with the right logic for your measure
and build the cube on the view. Assuming that you're using SQL Server,
CASE
WHEN ShippedDate IS NULL Then 0
ELSE 1
END AS DeliveryCount

Add the DeliveryCount column as a measure to your cube and set the aggregate
function for the DeliveryCount measure to Sum.

"Suresh Kumar" <skumat@pcdiDOTcom> wrote

Quote:
I am creating a cube for one of our fact tables. (ORDER)
If one of the date columns (DeliveryDate) is Non-Null I need to count the
record.
(Basically, I need to count the number of ORDER table records that have
non
null in the DeliveryDate column).

I know how to create some standard Measures and Dimensions in a Cube.
Howver, could someone give me the broad steps involved in creating the
above
Measure of counting the nonnull DeliveryDate values.

Thanks,
S.Kumar





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.