Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
vytas
Helper I
Helper I

Debt Aging

Hello 

 

 I have table  G7Ab7CF.png

 and want to write a measure Debt Age in  Days which is how much sales days fit in Accounts Recievable. 

For example - 2015-01-09 accounts recievable is 109 and it is 9 days of sales. 
Measure should be - take accounts recievable  at any day and  go backwards on sale untill  sales sum reach debt sum then count how much it was sale days. 

 

Thank You  

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @vytas 

 

Based on your description, I created data to reproduce your scenario.

Table:

f1.png

 

You may create a measure as below.

Debt Age in  Days = 
var _accountsrecievable = SELECTEDVALUE('Table'[AccountsRecievable])
var _date = SELECTEDVALUE('Table'[Date])
return
IF(
    _accountsrecievable = 
    CALCULATE(
        SUM('Table'[Sales]),
        FILTER(
            ALLSELECTED('Table'),
            'Table'[Date]<=_date
        )
    ),
    COUNTROWS(
        FILTER(
            ALLSELECTED('Table'),
            'Table'[Date]<=_date
        )
    )
)

 

Result:

f2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-alq-msft
Community Support
Community Support

Hi, @vytas 

 

Based on your description, I created data to reproduce your scenario.

Table:

f1.png

 

You may create a measure as below.

Debt Age in  Days = 
var _accountsrecievable = SELECTEDVALUE('Table'[AccountsRecievable])
var _date = SELECTEDVALUE('Table'[Date])
return
IF(
    _accountsrecievable = 
    CALCULATE(
        SUM('Table'[Sales]),
        FILTER(
            ALLSELECTED('Table'),
            'Table'[Date]<=_date
        )
    ),
    COUNTROWS(
        FILTER(
            ALLSELECTED('Table'),
            'Table'[Date]<=_date
        )
    )
)

 

Result:

f2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@vytas , What is formula for this

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
camargos88
Community Champion
Community Champion

Hi @vytas ,

 

Does it work if you use the DAY function on your date sales ?

 

Did I answer your question? Mark my post as a solution!
Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



No, it's just match in example.  Measure should be - take accounts recievable sum at any day and  go backwards on sale untill  sales sum reach debt sum then count how much it was sale days. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.