?
Solved

SSAS 2008 MDX Calculate Average Between Two Measures

Posted on 2010-09-10
1
Medium Priority
?
1,583 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 38

Accepted Solution

by:
puppydogbuddy earned 1000 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

777 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