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

Need help with an MDX query to find TOP 10 Customers who are close to the Target amount.....

$
0
0

Hi Guys,

My question is not getting the TOP 10 customers, but getting the TOP 10 Products that are close to the Target amount.

I have the following measures.

1) [Measures].[Sales Amount] --- THERE are can be negative and NULL values as well...

2) [Measures].[Sales Amount Target] -- THERE will be only Positive values or NULL values too...

My Dimension is [Product].[Product].[Product].Members.

I wrote an MDX like this..

WITH MEMBER [Measures].[Sales Diff] AS
[Measures].[Sales Amount Target] - [Measures].[Sales Amount]
SELECT {[Measures].[Sales Amount], [Measures].[Sales Amount Target]} ON 0,
TOPCOUNT([Product].[Product].[Product].Members, 10 , [Measures].[Sales Diff]) ON 1
FROM XYZCube;

The problem here is if I have a negative sales amount and a null Target value like

(100)  (null) then SalesDiff becomes +100... and I am getting wrong results.

Can you help me where I am going wrong with this MDX.. I am working 10 different things and I am lost on this for now..

Thanks in Advance..


Viewing all articles
Browse latest Browse all 14337

Trending Articles



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