SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Calculated Measures using Case or IIF statement and not getting correct Subtotals on Pivot tables.


Calculated Measures using Case or IIF statement and not getting correct Subtotals on Pivot tables.

Author
Message
ssimmons 2102
ssimmons 2102
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1082 Visits: 287
I have the following Calculated measure -

CREATE MEMBER CURRENTCUBE.[Measures].[Act - Fcst Lbs] AS

case when [Measures].[Act- Fcst Flag]= 0
then [Measures].[Invoiced Pounds]
else [Measures].[DMP - Forecast Lbs]
end,
FORMAT_STRING = "$#,##0;($#,##0)",
VISIBLE = 1 , DISPLAY_FOLDER = 'Calcs' , ASSOCIATED_MEASURE_GROUP = 'DMP Forecast';


works great. however when I display with our calendar hierarchy Dimension, the months will display the correct values, but the subtotal on Year will not be correct. I know its because the calculation is occurring on the Year line. I've tried a Scope statement to override the year, which works IF you select all the months in the year. but if you select just a couple, then the total is not correct.

If the source if the values were not in 2 different places I'd take care of this in the SQL source table.

Our Calendar Dimension Hierarchy is as follows

[Calendar].[Fiscal],[Fiscal Year].[Fiscal Month]

Any directed would be grateful
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search