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


Calculated member problem -> to show Full year data for each month


Calculated member problem -> to show Full year data for each month

Author
Message
piggy69
piggy69
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 10
Hi,

I do have a following problem:

Time dimension with hierarchy [Time].[Year - Month] with levels Year and Month and some measures.
For example calculated measure YTD:

CREATE MEMBER CURRENTCUBE.[Measures].[YTD]
AS AGGREGATE(
YTD([Time].[Year - Month].CurrentMember)
,[Measures].[Value]),
FORMAT_STRING = "#,##0.00;-#,##0.00",
VISIBLE = 1 , DISPLAY_FOLDER = 'Calculated measures';

But I need to create a calculated measure [FY] which would show Full Year data for each month (meaning it would be constant for each month within one year).

Does anyone has any idea?

I would really appreciate it.

Ondra
sneumersky
sneumersky
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2492 Visits: 487
Are you saying that each month column needs to show data for the current month AND the previous 11 months; or, does the number of "previous months of data to display" vary for each month column in your cellset? If you just need to show the last 11 months along with the current month, I would go with the RANGE OPERATOR (Smile combined with LAG(11).

For example in Adventure Works:

SUM(
[Date].[Month Name].CurrentMember.Lag(11) :
[Date].[Month Name].CurrentMember,
[Measures].[Internet Sales Amount]
)
,
FORMAT_STRING = “Currency”,
VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = ‘Internet Sales’;
piggy69
piggy69
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 10
Thx a lot for your answer.
I finally managed this way:

CREATE MEMBER CURRENTCUBE.[Measures].[Full Year]
AS AGGREGATE(
ANCESTOR( [Time].[Year - Month].CurrentMember,[Time].[Year - Month].[Year] ), [Measures].[Value]),
FORMAT_STRING = "#,##0.00;-#,##0.00",
VISIBLE = 1 , DISPLAY_FOLDER = 'Calculated measures' , ASSOCIATED_MEASURE_GROUP = 'Line Items' ;
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