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 |