dbTalk Databases Forums  

Generate ALL flag doesn't return duplicates

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


Discuss Generate ALL flag doesn't return duplicates in the microsoft.public.sqlserver.olap forum.



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

Default Generate ALL flag doesn't return duplicates - 06-16-2005 , 01:39 PM






Hi,

Does anyone know why the Generate ALL flag doesn't work in this Query?

A little background on the query:
*We use a NonEmptyCrossJoin with only one set so we can filter out empty
rows but still have empty calculated members outside of the
nonemptycrossjoing.

*[expanded] is a set created for each item the user clicks to expand. We
bring back all the decendents for each top level item.

*In the original set we use bottomcount, and topcount to limit the return
base on the top sorted items. It doesn't matter in this query as there are
only 5 items but other queries may have more items.

*I use an Intersect to create a set of a single member which is basically
checking to see if the currentmember is in the [expanded] set. I then
convert it to a string and check to see if it is an empty set.

* If the item is not expanded then I return the current member, otherwise I
return the descendents and order them keeping hierarchy. I convert the set
to a string because IIF requires it. I then take the string from IIF and
convert that back to a set.

*To the Generate statement I am using Generate(<set>,<set>,[ALL]) so the ALL
flag should work but it does not. These two items "[Web
Hierarchy].&[3502591],[Web Hierarchy].&[3502584]" are under the [expanded]
item in hierarchy so when they return in the expanded hiearchy the GENERATE
statement for some reason eliminates them from the regular set.

WITH SET [expanded] AS '{[Web Hierarchy].&[3502449]}'
SELECT {[Time].&[63],[Time].&[64],[Time].&[65]} ON COLUMNS, {[Web
Hierarchy].&[1],

NonEmptyCrossjoin(
GENERATE(
ORDER(
BOTTOMCOUNT(
TOPCOUNT({[Web Hierarchy].&[3487171],[Web
Hierarchy].&[3502591],[Web Hierarchy].&[3502584],[Web
Hierarchy].&[438672],[Web Hierarchy].&[3502449]}, 5, AXIS(0).ITEM(2))
, 5, AXIS(0).ITEM(2))
, AXIS(0).ITEM(2)
, BDESC),
StrToSet(
IIF(
SetToStr(Intersect({[Web Hierarchy].CurrentMember},
[expanded])) = "{}"
,SetToStr({[Web Hierarchy].CurrentMember})
,SetToStr(
ORDER(Descendants([Web Hierarchy].CurrentMember,
0, SELF_AND_AFTER), AXIS(0).ITEM(2), DESC))
)
), ALL
),
Axis(0), 1)} DIMENSION PROPERTIES [Web Hierarchy].[Key], [Web
Hierarchy].[Level Id], PARENT_UNIQUE_NAME, MEMBER_TYPE ON ROWS FROM
[MM2_US_Main] WHERE ([Location].&[0], [Country].&[840], [Gender Age].[All
Gender Age], [Measures].[Total Unique Visitors (000)])

Thank you for any help in advanced,

Tony

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.