dbTalk Databases Forums  

Varying Results with Extract Function

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


Discuss Varying Results with Extract Function in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
rush_edward (AT) eddierush (DOT) net
 
Posts: n/a

Default Varying Results with Extract Function - 07-07-2006 , 09:41 AM






I have a problem when using the extract function:

If I use a multiple dimension nonemptycrossjoin to extract the Customer
Chain dimension using the following
set
[rowfilter] as
'extract({nonemptycrossjoin({[Time_Partial].[All
Time_Partial].[2006].[Qtr2 - 2006].[Period 06 - 2006].[Week 26 -
2006]},{[Customer].[Trade].[sMajTrade].&[26]},{[Customer].[Type].[sType].&[VHVW]},
{[Customer].[Chain].[sState].Members})},[Customer].[Chain])'

I get a completely different set of information than if I do not use
the extract function at all. However, I need two dimension display with
Sales info on my columns and Customers by State on my rows with the
specific criteria.

However, if I put must of my criteria in my Where Clause and only have
two dimension and use the extract, I always get the correct results.

Why does extract work in this manner?



////////////////////////////////////////////////////////////////////////////////////////
//Query One that gives me the correct results
//////////////////////////////////////////////////////////////////////////////////////////
with
set [main]
as
'{[Measures].[cGrossSales],
[Measures].[cPYGrossSales],
[Measures].[pGrossSalesGrowth%],
[Measures].[cCYPtdGrossSales],
[Measures].[cPYPtdGrossSales],
[Measures].[pPtdGrossSalesGrowth%],
[Measures].[cCYQtdGrossSales],
[Measures].[cPYQtdGrossSales],
[Measures].[pQtdGrossSalesGrowth%],
[Measures].[cCYYtdGrossSales],
[Measures].[cPYYtdGrossSales],
[Measures].[pYtdGrossSalesGrowth%]}'



set
[rowfilter] as
'order({extract({nonemptycrossjoin({[Customer].[Type].[sType].&[VHVW]},
{[Customer].[Chain].[sState].Members})}, [Customer].[Chain])},
[Customer].[Chain], BASC) '
member [Customer].[Chain].[Total] as 'sum({rowfilter})'

select
[main]
on columns,
{[rowfilter], [Customer].[Chain].[Total]}
on rows

FROM CusItmWk_Dev
WHERE([Customer].[Trade].[sMajTrade].&[26], [Time_Partial].[All
Time_Partial].[2006].[Qtr2 - 2006].[Period 06 - 2006].[Week 26 - 2006])



////////////////////////////////////////////////////////////////////////////////////////
//Query Two that gives me different results
//////////////////////////////////////////////////////////////////////////////////////////

with
set [main]
as
'{[Measures].[cGrossSales],
[Measures].[cPYGrossSales],
[Measures].[pGrossSalesGrowth%],
[Measures].[cCYPtdGrossSales],
[Measures].[cPYPtdGrossSales],
[Measures].[pPtdGrossSalesGrowth%],
[Measures].[cCYQtdGrossSales],
[Measures].[cPYQtdGrossSales],
[Measures].[pQtdGrossSalesGrowth%],
[Measures].[cCYYtdGrossSales],
[Measures].[cPYYtdGrossSales],
[Measures].[pYtdGrossSalesGrowth%]}'



set
[rowfilter] as
'extract({nonemptycrossjoin({[Time_Partial].[All
Time_Partial].[2006].[Qtr2 - 2006].[Period 06 - 2006].[Week 26 -
2006]},{[Customer].[Trade].[sMajTrade].&[26]},{[Customer].[Type].[sType].&[VHVW]},
{[Customer].[Chain].[sState].Members})},[Customer].[Chain])'


select
[main]
on columns,
[rowfilter]
on rows

FROM CusItmWk_Dev


////////////////////////////////////////////////////////////////////////////////////////

Ignore the Order function.


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.