Pct af total

Dette MDX eksempel viser hvordan man kan beregne den aktuelle pct af total salget, og pct af total salget for niveauet over det aktuelle.

WITH 
 MEMBER [Measures].[Pct of total] AS ' 
     SUM( {[Product].CurrentMember}, [Measures].[Unit Sales]) / 
     SUM( {[Product].DefaultMember}, [Measures].[Unit Sales])', 
     FORMAT_STRING='#0.00%' 
 MEMBER [Measures].[Pct of parent total] AS ' 
     IIF( [Product].Parent  NULL, 
     SUM( {[Product].CurrentMember}, [Measures].[Unit Sales]) / 
     SUM( {[Product].Parent.Children}, [Measures].[Unit Sales]), 1)', 
     FORMAT_STRING='#0.00%' 
SELECT 
 { [Measures].[Unit Sales], 
    [Measures].[Pct of Total], 
    [Measures].[Pct of parent total] } ON COLUMNS, 
 NON EMPTY 
    Order( DESCENDANTS( [Product]  ), 
    [Measures].[Pct of total], DESC ) ON ROWS 
FROM 
[Sales]

Loading

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.