我有一个时间维度,其层次结构包含year-> month(ano-> mes,如下所示)。 我尝试了很多例子(比如这个:MDX return last month of every year但没有成功......
我只需要为每年的数据检索上个月的值。我不需要这个月的名字。
所以,我想出了这个:
WITH MEMBER [Measures].[M1] AS 'iif([tempo.hie_d_ano_mes].currentmember = [tempo.hie_d_ano_mes].parent.lastChild, 1.0, null)'
MEMBER [Measures].[M2] AS '([Measures].[followers], [tempo.hie_d_ano_mes].currentmember.lastchild)'
MEMBER [Measures].[M3] AS '(CLOSINGPERIOD([tempo.hie_d_ano_mes].[mes], [tempo.hie_d_ano_mes].CurrentMember), [Measures].[followers])'
SELECT CrossJoin({[hie].[Grupo UC]}, [tempo.hie_d_ano_mes].[2015] : [tempo.hie_d_ano_mes].[2016]) ON ROWS,
NON EMPTY {[Measures].[followers], [Measures].[M2]} ON COLUMNS
FROM [cubo_social]