In my scenario I need to calculate Total Distance Covered, but in the data i get there is only the Total Distance Accumulated , so if i want to know what is total distance covered say in year 2012 i need to get :
Total Distance Accumulated at END of Year 2012 - Total Distance Accumulated at END of Year 2012
And I want this calculation to work on any level of the Date Dimension(which in this case is down to Day level), so a user can place it in a pivot table and just play with it as he sees fit. I am not sure how or if i can do such a calculation member using MDX on the cube level.
Also, I'm working with SQL 2008 Standard addition, so no semi additive functions available.
WITH MEMBER [Measures].[Total Distance Travelled] as
(
SUM(CurrentDateMember([<hierarchy>],'["<hierarchy>"]\.[<DATE Level>]\.[yyyy-mm-dd]').lag(x):CurrentDateMember([Dates.Time],'["Dates.Time"]\.[Date]\.[yyyy-mm-dd]'),[Measures].[Total Distance Accumulated]))
Select {[Measures].[Total Distance Travelled]} On 1
from [<cube name>]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.