﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Data Warehousing / Analysis Services  / mdx tail function not working on currentmember / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 08:20:30 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: mdx tail function not working on currentmember</title><link>http://www.sqlservercentral.com/Forums/Topic1395031-17-1.aspx</link><description>Hi Mack ,I'm on a roll...even simpler...using the "null" value brings back the first member of a set on the same level as the current member...only works if you use the range : (colon)-- Previous 3 month sales using tail and "null"WITH MEMBER [Measures].[PrevThreeMonthSales] AS 'SUM(Tail(null:[Order Date].[CalendarHierarchy].CurrentMember,3), [Measures].[Sales Amount])'SELECT  {[Measures].[Sales Amount], PrevThreeMonthSales}  ON 0,       [Order Date].[CalendarHierarchy].[Month] On 1FROM MyFirstCube  CheersRobin</description><pubDate>Tue, 11 Dec 2012 06:43:00 GMT</pubDate><dc:creator>robinrai3</dc:creator></item><item><title>RE: mdx tail function not working on currentmember</title><link>http://www.sqlservercentral.com/Forums/Topic1395031-17-1.aspx</link><description>Hi Mack,Your a diamond among the gems....fixed it...using your reply...gone back and determined the first child and created the set...and then did a tail on it....-- Previous 3 month sales using tailWITH MEMBER [Measures].[PrevThreeMonthSales] AS 'SUM(Tail([Order Date].[CalendarHierarchy].CurrentMember.Parent.Children(0):[Order Date].[CalendarHierarchy].CurrentMember,3), [Measures].[Sales Amount])'SELECT  {[Measures].[Sales Amount], PrevThreeMonthSales}  ON 0,       [Order Date].[CalendarHierarchy].[Month] On 1FROM MyFirstCube </description><pubDate>Tue, 11 Dec 2012 05:19:53 GMT</pubDate><dc:creator>robinrai3</dc:creator></item><item><title>RE: mdx tail function not working on currentmember</title><link>http://www.sqlservercentral.com/Forums/Topic1395031-17-1.aspx</link><description>You need to provide the Tail function with a set - you have provided the current member which is just one value ie a set with one valueSo Tail(CurrentMember,3) = CurrentMember.  An example I use in my cubes (to get the latest year with revenue)TAIL(NONEMPTY({[Date].[Year].Children},{[Measures].[Net Revenue]}),1);Mack</description><pubDate>Tue, 11 Dec 2012 04:35:21 GMT</pubDate><dc:creator>Mackers</dc:creator></item><item><title>mdx tail function not working on currentmember</title><link>http://www.sqlservercentral.com/Forums/Topic1395031-17-1.aspx</link><description>Hi All mdx gurus,I was checking out the tail function to achieve same the rolling 3 month sales which works using the lag function...as follows :-- Previous 3 month salesWITH MEMBER [Measures].[PrevThreeMonthSales] AS 'SUM( [Order Date].[CalendarHierarchy].CurrentMember : [Order Date].[CalendarHierarchy].CurrentMember.Lag(2), [Measures].[Sales Amount])'SELECT  {[Measures].[Sales Amount], PrevThreeMonthSales}  ON 0,       [Order Date].[CalendarHierarchy].[Month] On 1FROM MyFirstCubethis does not  however using tail substitution: -- Previous 3 month sales using tailWITH MEMBER [Measures].[PrevThreeMonthSales] AS 'SUM(Tail([Order Date].[CalendarHierarchy].CurrentMember,3), [Measures].[Sales Amount])'SELECT  {[Measures].[Sales Amount], PrevThreeMonthSales}  ON 0,       [Order Date].[CalendarHierarchy].[Month] On 1FROM MyFirstCube all i get is the same value for the current member  Question ?  Can the tail function not create dynamic sets on currentmember</description><pubDate>Tue, 11 Dec 2012 04:28:37 GMT</pubDate><dc:creator>robinrai3</dc:creator></item></channel></rss>