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

Help with MDX Query Result weirdness

$
0
0

Hi,

Feels like I'm posting a question every other day, hope I don't wear out my welcome.

So I have a working query :

with
	MEMBER Measures.[EmailCount] as IIF(ISEMPTY([Measures].[Tran Count]), 0 ,[Measures].[Tran Count])
	MEMBER Measures.AdvGroupTotal as
		SUM (EXISTING ([Dim IFA Details].[Parent Key].[Adviser Group] ,
		[Dim Date].[Fiscal].[Fiscal Year].&[FY 13/14]) , Measures.[Amount])
    MEMBER [Measures].[Income Range] as
	 CASE
          WHEN Measures.AdvGroupTotal <= 10000 THEN  '0-10000'
		  WHEN Measures.AdvGroupTotal <= 50000 THEN  '10001-50000'
		  WHEN Measures.AdvGroupTotal <= 100000 THEN  '50001-100000'
		  WHEN Measures.AdvGroupTotal <= 200000 THEN  '100001-200000'
			else '200000-'
		  end
SELECT { [Measures].[Amount] , Measures.[EmailCount],  Measures.AdvGroupTotal, measures.[income range]}
  ON COLUMNS,
 [Dim IFA Details].[Parent Key].[Adviser Group].Members * [Dim Date].[Fiscal Quarter].children
 having  Measures.AdvGroupTotal > 100
on rows
FROM [Income and Emails Cube]
where
([Dim Date].[Fiscal].[Fiscal Year].&[FY 13/14]
)

Great, gives me back what I expect

So now I'm thinking, actually let's lose the Adviser Groups and just have it by Fiscal Quarter and Income Range, dropping that I lose my income range and get this:

I figured its related to Income Range being a measure, so I tried making income range a calculated member of a dimension

with
	MEMBER Measures.[EmailCount] as IIF(ISEMPTY([Measures].[Tran Count]), 0 ,[Measures].[Tran Count])
	MEMBER Measures.AdvGroupTotal as
		SUM (EXISTING ([Dim IFA Details].[Parent Key].[Adviser Group] ,
		[Dim Date].[Fiscal].[Fiscal Year].&[FY 13/14]) , Measures.[Amount])
    MEMBER [Dim IFA Details].[Parent Key].[Income Range] as
	 CASE
          WHEN Measures.AdvGroupTotal <= 10000 THEN  '0-10000'
		  WHEN Measures.AdvGroupTotal <= 50000 THEN  '10001-50000'
		  WHEN Measures.AdvGroupTotal <= 100000 THEN  '50001-100000'
		  WHEN Measures.AdvGroupTotal <= 200000 THEN  '100001-200000'
			else '200000-'
		  end
SELECT { [Measures].[Amount] , Measures.[EmailCount],  Measures.AdvGroupTotal}
  ON COLUMNS,
( [Dim Date].[Fiscal Quarter].children, [Dim IFA Details].[Parent Key].[Income Range] )
on rows
FROM [Income and Emails Cube]
where
([Dim Date].[Fiscal].[Fiscal Year].&[FY 13/14]
)

This then came back with some unexpected results:

The amount and email count are now the Income Range and still didnt get the income grouping I want.

What am I doing wrong?

Thanks for reading.

Regards

Jon


Viewing all articles
Browse latest Browse all 14337

Trending Articles



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