dbTalk Databases Forums  

Generate/VisualTotals and Non-VisualTotals in Same Set

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


Discuss Generate/VisualTotals and Non-VisualTotals in Same Set in the microsoft.public.sqlserver.olap forum.



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

Default Generate/VisualTotals and Non-VisualTotals in Same Set - 05-12-2011 , 05:21 PM






I am trying to show values of a set, the subtotals of their parents
(using Generate/VisualTotals), and the totals of those same parents
all on one axis. Here is the concept in Adventure Works:


WITH

// Cities I'm interested in
SET CitySet as
{
[Geography].[Geography].[City].&[Irvine]&[CA],
[Geography].[Geography].[City].&[Oakland]&[CA],
[Geography].[Geography].[City].&[Palo Alto]&[CA],
[Geography].[Geography].[City].&[Sacramento]&[CA],
[Geography].[Geography].[City].&[Denver]&[CO],
[Geography].[Geography].[City].&[Englewood]&[CO],
[Geography].[Geography].[City].&[Westminster]&[CO],
[Geography].[Geography].[City].&[Destin]&[FL]
}

// States for cities
SET StateSet as
Generate
(
CitySet,
{[Geography].[Geography].currentmember.parent}
)

// State subtotals
SET StateSubtotalSet as
Generate
(
VisualTotals
(
Hierarchize
(
[CitySet] + [StateSet]
),
"* - Subtotal"
)
,
[StateSet]
)

SELECT
[Measures].[Reseller Sales Amount] on 0,
Hierarchize
(
{
CitySet,
StateSet,
StateSubtotalSet
}
) on 1

FROM
[Adventure Works]


The problem is, once I define the StateSubtotalSet set using the
Generate/VisualTotals method, it affects the StateSet set by
effectively replacing StateSet with StateSubtotalSet. Is this
expected behavior? Should I be going about this a different way?

Thanks,
Mitch

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.