Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

Many To Many relationship, Distinct Aggregate issue

$
0
0

Hi, 

I need some help pleeeaaase... 

Ok, so i'm implementing a GL cube, and i have a bunch of accounts which can be aggregated to different levels of a parent child hierarchy, because i'm using a parent child hierarchy SSAS does a distinct "sum" to the Fact table, and so my Totals get a bit messed up... 

So, i've tried looking for way to turn off this feature, but couldn't find one.

The alternative which i'm also stuck on, which is to create a member which goes to the child level, for each total, and re-aggregates ALL the values that are there.

I seem to have created a member in an MDX query that works perfectly... yay!, BUT when i put this into a calculated member... well it goes pear shaped, and i can't understand how it arrives at the number.. 

Please shout if my explanation is a bit sketchy..

Here is the code.

MDX Query....

 

WITH MEMBER [Measures].CurrentBalanceActualDecendants
AS 
(
SUM(
                       EXCEPT(
                                  DESCENDANTS([Dimension Report Detail].[Finance Report Hierachy].CurrentMember, 2, BEFORE),
                                  [Dimension Report Detail].[Finance Report Hierachy].CurrentMember
                           ),
                     [Measures].[Current month Actual]
              )

)


MEMBER [Measures].[BalanceTestc]
AS( IIF(
                     [Measures].CurrentBalanceActualDecendants = 0, 
                     [Measures].[Current month Actual],
                     [Measures].CurrentBalanceActualDecendants
              )
)


SELECT{[Measures].[Current month Actual],
[Measures].[BalanceTestc]}
on 0
,
(
DESCENDANTS([Dimension Report Detail].[Finance Report Hierachy].&[4], 3, BEFORE)
--[Dimension Report Detail].[Finance Report Hierachy].Allmembers
)on 1
FROM [opfinanceGLTransaction]
WHERE {[Dimension Snapshot].[Date Value].&[2014-06-30T00:00:00],
[Dimension Snapshot].[Date Value].&[2014-05-31T00:00:00],
[Dimension Snapshot].[Date Value].&[2014-04-30T00:00:00],
[Dimension Snapshot].[Date Value].&[2014-03-31T00:00:00],
[Dimension Snapshot].[Date Value].&[2014-02-28T00:00:00],
[Dimension Snapshot].[Date Value].&[2014-01-31T00:00:00]
}

CALCULATED Measure.......


CREATE MEMBER CURRENTCUBE.[Measures].[Current Month Actual]
 AS IIF(
                     [Measures].CurrentmonthActualDecendants = 0, 
                     [Measures].[Balance],
                     [Measures].CurrentmonthActualDecendants
              ), 
VISIBLE = 1 ,  ASSOCIATED_MEASURE_GROUP = 'Fact GL Transaction';   


CREATE MEMBER CURRENTCUBE.[Measures].CurrentmonthActualDecendants
 AS AGGREGATE(
                       EXCEPT(
                                  DESCENDANTS([Dimension Report Detail].[Finance Report Hierachy].CurrentMember, 2, BEFORE),
                                  [Dimension Report Detail].[Finance Report Hierachy].CurrentMember
                           ),
                     [Measures].[Balance]
              ), 
VISIBLE = 1 ,  ASSOCIATED_MEASURE_GROUP = 'Fact GL Transaction';        



Viewing all articles
Browse latest Browse all 14337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>