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

How to Zero Debt After Account Closure Date in MDX Calculated Measure

$
0
0

Thanks in advance to anyone who can help me with the below problem.

I’m building a Finance cube, it holds all customers we have billed and any cash received against their debt. I have a few calculated measures that work out Total Debt, Total Cash. From these I have a calculated measure called Total Debt Outstanding which is (Total Debt - Total Cash)

My problem, when an account is closed the debt is not always zero. We don’t always get all the cash to cover the debt so just write off the outstanding debt. I have a requirement to zero out the debt after closure date has passed. If I look at the calculated measure [Total Debt Outstanding] today for all accounts it will include debt figures from closed accounts, I need the calculated measure[Total Debt Outstanding] to ignore this and not to inflate my current debt figure.

Example

Account 12345, Debt £3142 added on 15/03/2013, Cash £1,687received on 12/12/2013, Total Debt Outstanding £1107. The Account closed on 15/12/2013 with a balance of £1107, after the closure date I need the total Debtor outstanding figure to be £0 if you browse the cube with my date dimension. My date dimension Hierarchies is Year-Quarter-Month-Day

I have tried using the Scope function to Zero the Total Debt Outstanding figure after closure date but can’t get it to work. My scope calculation is below:

Scope([Measures].[Total Debt Outstanding]);    
This = IIF([Date].[Year-Quarter-Month-Day].Currentmember > [ClaimData].[Closed].[Closed].Currentmember,0,[Measures].[Total Debt Outstanding]); 
End Scope;  

My Account Opening and Closing dates are in my ClaimData fact table, with Opening Date linked to the date dimension. I can’t link Closing date as we don’t always have a closing date until the account closes, so SSAS errors.

Many Thanks


Viewing all articles
Browse latest Browse all 14337

Trending Articles



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