Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

average balance in year for the selected month

$
0
0

Hi all,

Tried to write MDX to show average balance for the year for the selected month.

2009           2 (avg bal)

          01    1

         02      2

         03       3

existing code...

measure.[bal]/count(nonempty(date.period.currentmember.children,measures.bal))

But the above code works when year is selected with all month. But when selecting few months (month 01, 02), the result

is showing as 1. 

  3/3 =1 (denominator is all children for the year irrespective month selection). Need help how to get correct avg balance when selecting particular month in a year.  when selecting month 02 and 03 the avg balance is 5/2 = 2.5

tried below calculation as well. still the same result.

Avg( Descendants([Date].[period].currentmember
, [Date].[period].[Month])
, [Measures].[bal]
)


Thank you.


Viewing all articles
Browse latest Browse all 14337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>