Thursday, March 22, 2012

Calculated field in a Cube

Hi!

I need your help!..

I need aid to obtain a value in a calculated field, I am using cube with dimension in the date.

The idea is that as of a specific month the accumulated sum of a value is obtained in a calculated field, starting off from the month of January of he himself year that the specified month previously.

For example:

If I indicate the month of April, the sum of the value had to be:

Total = Value January + Value February + Value March + Abril Value

The previous months are of he himself year that the month of April and does not have to take values from the previous year.

If it indicated the month of December it must add the 12 months of the year to which that month corresponds I hope somebody can help me.

From already, thank you very much!

Assuming that your date dimension has its levels tagged with the appropriate time types, then you could simply use YTD(), like:

Sum(YTD([Date].CurrentMember), [Measures].[MyValue])

If the date levels aren't appropriately tagged, PeriodsToDate() is a more general function, like:

Sum(PeriodsToDate([Date].[Year].[Year], [Date].CurrentMember), [Measures].[MyValue])

No comments:

Post a Comment