YTD dosn't work on Dimension Time in a simple month (month without year)

29 Views Asked by At

I would like to know if is possible have a YTD measure in a usually time dimension without show the year when I select the month.

when I select the YTD and select the month not summarize, just show me the month import, no accumulate.

sum(ytd([Time].[Time].currentmember),[MEASURES].[IMPORT])

enter image description here

I would like to know if is possible YTD summarize when I select the month without the year.

In a post I found a solution with a scope, but the result is not what I expected (I'm sure I'm doing something wrong)

SCOPE([TIME].[YEAR].members,[TIME].[TIME].[MONTH].members);

   ([measures].[Margen YTD Time]=         
        SUM(                
            CrossJoin(
                {[MEASURES].[IMPORT]},                  
                PeriodsToDate([TIME].[TIME].[YEAR]
                )
            )
        )

    );
End Scope;  

the result:

enter image description here

1

There are 1 best solutions below

0
Amira Bedhiafi On

In your scope assignment, there seems to be a confusion in using PeriodsToDate with [TIME].[TIME].[YEAR], which might be not right referencing level needed for YTD aggregation. The PeriodsToDate function should ideally be used with the correct level argument that identifies the "Year" level within your time dimension to roll up values from the beginning of the year to the current period.

Your IMPORT YTD shoulf be like :

WITH MEMBER [Measures].[IMPORT YTD] AS
    SUM(
        YTD([Time].[Time].CurrentMember),
        [Measures].[IMPORT]
    )

and using the SCOPE :

SCOPE([Time].[Time].Members);
    [Measures].[Margen YTD Time] = SUM(
        YTD([Time].[Time].CurrentMember),
        [Measures].[IMPORT]
    );
END SCOPE;