Quantcast
Channel: SQL Server Analysis Services Forum
Viewing all articles
Browse latest Browse all 2472

Count Distinct Measure, Rollup with SUM on One Dimension

$
0
0

 Hi,

I'm relatively new to SSAS and very new to calculated metrics.   I have a cube with several dimensions: Geography, Time, Channel, Product, etc.  I have a measure [Unique SKUs] that counts distinct product id's.  I want to create a new measure [Distribution Points] that performs this same function, but rolls up as a SUM in the geography dimension.  (I want to know how many unique skus there are at the leaf level within geography and then sum them up in the higher levels of that dimension.)  I have read a number of similar threads (but not quite the same.  Currently, I have the following script, which gives me NULL for this measure at all levels.  I hope I am missing something simple here. 

Tim

CALCULATE;    
CREATE MEMBER CURRENTCUBE.[Measures].[Distribution Points]
 AS (
IIf(IsLeaf([Geography].currentmember),
   ([Measures].[Unique Skus].Value),
   sum([Geography].currentmember.children,
    [Measures].[Distribution Points])
)),
FORMAT_STRING = "0.0",
VISIBLE = 1 ;


Viewing all articles
Browse latest Browse all 2472

Trending Articles



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