dbTalk Databases Forums  

NonEmptyCrossJoin Problem

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


Discuss NonEmptyCrossJoin Problem in the microsoft.public.sqlserver.olap forum.



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

Default NonEmptyCrossJoin Problem - 03-05-2006 , 04:02 AM






Hi,
i need to get the first and last nonempty VALUEs on columns, so i tried
to use NonEmptyCrossJoin function but i found out that this function
return a set and i need a value
(correct me if i'm wrong). So, I need a function to get the first &
last values.

Any suggestions will be appreciated,
Thanx a lot.

Abobakr Nasr


Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: NonEmptyCrossJoin Problem - 03-05-2006 , 07:16 PM






Hi Abobakr,

Can you give an idea of the context in which you want to return the
first and last non empty values - what should the results look like?

Here's a sample query for Adventure Works, which returns the first and
last non empty values of the first measure which is on rows:

Quote:
With Member [Measures].[FirstNonEmpty] as
Sum(Head(NonEmptyCrossJoin(StrToSet("Axis(0)"),
Head(StrToSet("Axis(1)")), 1)),
StrToSet("Axis(1)").Item(0))
Member [Measures].[LastNonEmpty] as
Sum(Tail(NonEmptyCrossJoin(StrToSet("Axis(0)"),
Head(StrToSet("Axis(1)")), 1)),
StrToSet("Axis(1)").Item(0))

select [Date].[Calendar].[Month].Members on columns,
{[Measures].[Order Quantity],
[Measures].[FirstNonEmpty],
[Measures].[LastNonEmpty]} on rows
from [Adventure Works]
where [Product].[Product Categories].[Product Name].&[462]
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.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.