We have an OLAP cube with the following dimensions: Ship_Date, Product, Customer. The measures are Units, Cost, List Price, Sell Price.
We want to set up calculations of Cost/Unit, List Price/Unit and Sell Price, like the below:
[Measure].[Cost]/[Measure].[Units]
This works with one time elements (All Ship Dates, 2016, Jan 2016, etc.) but when multiple elements are selected, like 2016 & 2015 or Jan 2016 & Feb 2016, the calculation does not resolve correctly which we think is because it is summing the ratios instead of calculating against the sums.
I tried the below calculations to similar results:
SUM([Ship_Date].CurrentMember.Level.Members,[Measure].[Cost]) /
SUM([Ship_Date].CurrentMember.Level.Members,[Measure].[Units])
SUM(Descendants([Ship_Date].CurrentMember, [Month]), [Measure].[Cost]) /
SUM(Descendants([Ship_Date].CurrentMember, [Month]), [Measure].[Units])
Aggregate(Descendants([Ship_Date].CurrentMember, [Date]), [Measure].[Cost]) /
Aggregate(Descendants([Ship_Date].CurrentMember, [Date]), [Measure].[Units])
I'm very new to MDX - can someone please point me in the right direction?