dbTalk Databases Forums  

NON EMPTY vs. NonEmpty()

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


Discuss NON EMPTY vs. NonEmpty() in the microsoft.public.sqlserver.olap forum.



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

Default NON EMPTY vs. NonEmpty() - 09-10-2006 , 08:35 PM






Wondering what are the pros and cons (and performance implications) of NON
EMPTY statement
vs. NonEmpty() function


--------------------
Chris Harrington
Active Interface, Inc.
http://www.activeinterface.com



Reply With Quote
  #2  
Old   
Jeje
 
Posts: n/a

Default Re: NON EMPTY vs. NonEmpty() - 09-10-2006 , 09:41 PM






nonempty() can be used into a formula
non empty is used only in the select statement (rows and columns only) and
can't be used in a formula.

non empty eliminate all empty tuples in rows and/or columns, you can't
choose on which member you'll apply it, all the rows or columns members are
used in the non empty evaluation. the non empty keyword is evaluated
regarding all the measures used in the query not a particular one only.
nonempty() is applied to the set used in the function only and you choose
which measure will be evaluated as empty.

select non empty dates.members * customer.members on 1, measures.sales on 0
from sales
returns only dates and customers with sales
select dates.members * nonempty(customer.members, measures.sales) on 1,
measures.sales on 0 from sales
returns all dates (including empty dates) but only customers with sales for
this date

from a performance point of view you'll have the same result (or near the
same result)

for the pros & cons... there is nothing to debate because each one is
designed for a different usage.
so, use each one when you need it!
if in a report you want to eliminate all empty rows and columns, you'll use
the non empty keyword.
in a formula, if you want to optimize a calculation the nonempty() function
will help you

only in 1 case the usage of each one is the same:
select non empty customers.allmembers on 1, measures.sales on 0 from sales
or
select nonempty(customers.allmembers, {measures.sales} ) on 1,
measures.sales on 0 from sales
provide the same result, but using the non empty keyword is easier to read
in this case.

I hope this will help you.


"ChrisHarrington" <charrington-at-activeinterface.com> wrote

Quote:
Wondering what are the pros and cons (and performance implications) of NON
EMPTY statement
vs. NonEmpty() function


--------------------
Chris Harrington
Active Interface, Inc.
http://www.activeinterface.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.