Solved

SSAS 2008 MDX Calculate Average Between Two Measures

Posted on 2010-09-10
1
1,565 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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Creating and Managing Databases with phpMyAdmin in cPanel.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now