Solved

SSAS 2008 MDX Calculate Average Between Two Measures

Posted on 2010-09-10
1
1,570 Views
Last Modified: 2016-02-14
Hi,

I need to be able to calculate an Average over two seperate measures within a SSAS 2008 Cube.

In my cube, I have two measures, one called [Measures].[Order Quantity] and the other called [Measures].[Order Quantity Week On Week]. The later is a Calculated Measure.

I need to be able to find the Median Average between the two.

So, if [Measures].[Order Quantity] = 1000 and [Measures].[Order Quantity Week On Week] = 1200, I need the Calculation to return 1100.

Is it possible at all to Calulcate an Average over two measures in MDX ?

Thanks
0
Comment
Question by:Aspinall
1 Comment
 
LVL 38

Accepted Solution

by:
puppydogbuddy earned 250 total points
ID: 33651003
See   http://www.sqldev.org/sql-server-analysis-services/avg-function-using-calculated-measure-in-ssas-9390.shtml

As explained in the link above, in order for the average to be computed correctly and only include the count of the measure in the average when measure is not null or zero, another field (AdjCount) should be created to impute the correct denominator by placeing the following formula in a field called AdjCount.
        AdjCount = case isnull([Measures].[OrderQuantity], 0) when 0 then 0 else 1 end
then the computation of the Avg would be as follows:
       ( [Measures].[OrderQuantity] + [Measures].[Order Quantity Week On Week]) / AdjCount  
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question