cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
paolomint
Helper II
Helper II

variation on rolling sum

Hi every one,

I have the following table:

 

Due dateCostumercredit limitdebit
01.06.2021SRD inc10.0003000
13.06.2021SRD inc10.0002000
20.06.2021SRD inc10.0001000
03.07.2021SRD inc10.000500

 

Considering that each debt is paid exactly on the due date, I need to calculate the residual bank credit taking into account the future debts already recorded. Following in the last colum the calculation I need to obtain:

 

 

Due dateCostumercredit limitdebitresidual credit line
01.06.2021SRD inc10.000300010.000-2000-1000-500
13.06.2021SRD inc10.000200010.000-1000-500
20.06.2021SRD inc10.000100010.000-500
03.07.2021SRD inc10.000500

 

 

Following the final result I need on visualization:

 

Due dateCostumercredit limitdebitresidual credit line
01.06.2021SRD inc10.00030006500
13.06.2021SRD inc10.00020008500
20.06.2021SRD inc10.00010009500
03.07.2021SRD inc10.00050010000

 

thank you very much

Paolo

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

Hi, @paolomint 

 

You can try like this:

Column =
'Table'[credit limit]
    - SUMX (
        FILTER (
            'Table',
            [Due date] > EARLIER ( 'Table'[Due date] )
                && [Costumer] = EARLIER ( 'Table'[Costumer] )
        ),
        [debit]
    )

v-janeyg-msft_0-1622447131858.png

Best Regards

Janey Guo

 

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

3 REPLIES 3
v-janeyg-msft
Community Support
Community Support

Hi, @paolomint 

 

You can try like this:

Column =
'Table'[credit limit]
    - SUMX (
        FILTER (
            'Table',
            [Due date] > EARLIER ( 'Table'[Due date] )
                && [Costumer] = EARLIER ( 'Table'[Costumer] )
        ),
        [debit]
    )

v-janeyg-msft_0-1622447131858.png

Best Regards

Janey Guo

 

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

amitchandak
Super User
Super User

@paolomint , a new column like

[credit limit] - sumx(filter(Table, [Due date] > earlier([Due date])),[debit])

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin

Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

Thank you very much  @amitchandak 

I'm really sorry, I made the example to easy.

Infact in the same table I have several companies and I need to calculate the residual credit row by row, client by client.

Please apologise.

I hope you can help me

Ciao

Paolo

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!