[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

SSAS 2008 MDX Calculate Average Between Two Measures

Posted on 2010-09-10
1
Medium Priority
?
1,590 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
What we learned in Webroot's webinar on multi-vector protection.
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.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

656 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