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 |