MDX , Calculate Number of days when the cummulative sum of Revenues from end of a month date match with the given debt amount.

Posted by Shuchi on Stack Overflow See other posts from Stack Overflow or by Shuchi
Published on 2010-11-25T17:13:02Z Indexed on 2010/12/21 13:54 UTC
Read the original article Hit count: 150

Filed under:

Hi,

I have a financial cube and i have to calculate Daily Sales Outstanding as :

Number of Days between the selected month last date and the earliest transaction date when cummulative sum of Revenue from last date of the month till the date where sum revenue <= the debt amount for the date .

e.g

On 31/12/2009 my debt amount = 2,500,000

                          31-Dec-09     30-Nov-09    15-Oct-09     31-Oct-09     

Revenue 1,000,000 1,000,000 500,000 1,0000

Cummulative sum of revenue 1,000,000 2,00,000 2,500,000 4,000,000

No of Days 31 30 16

On 15/Oct/09 cummulative revenue is 2,500,000 which equals my debt amount on that day

Count of Days = 31 + 31 + 16 = 76 Days.

In other words Sum Revenue from the selected date backwards until sum total equals or exeeds the total to date balance of the debtors.

Any help will be highly appreciated .

If i haven't explained clearly enough or if you need more information then please let me know.

Thanks in advance .

Shuchi.

© Stack Overflow or respective owner

Related posts about mdx