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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
martinfernandez
Frequent Visitor

Issue calculating Running total by columns

Hello,

 

I have a table with two main columns and a measure:

 

Rows: Vendor name
Columns: Transaction Date

Values: Accounting Balance

 

I need to create a matrix in Power BI with this data and the accounting balance added to the previous value.

 

 

As a case scenario I will use this example where the totals are calculated vertically (as usual):

 

This is what I really need:

 

A brief explanation of the previous table:

  1. Vendor 1 owed $200 on January 2017
  2. Vendor 1 owed $0 on February 2017 because he made a $200 payment
  3. Vendor 1 owed $50 on March 2017 because $0 + $50
  4. Vendor 1 owed $50 on April 2017 because he didn't make any payment.
  5. Vendor 1 owes $50 in total.
  6. etc

In other words I need to calculate the payments made by vendor for each month / column totals (that he owes in total). The last month (the current) will have the same debt as the total because it is cumulative.

 

Any suggestions? Thanks in advance

2 REPLIES 2
v-jiascu-msft
Employee
Employee

Hi @martinfernandez,

 

Could you please mark the proper answers as solutions?

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jiascu-msft
Employee
Employee

Hi @martinfernandez,

 

What does the original data look like? Please refer to the demo in the attachment. 

1. If you have a date table, you can use this one.

Measure 3 =
CALCULATE (
    SUM ( Table1[Value] ),
    FILTER ( ALL ( 'Calendar'[Date] ), 'Calendar'[Date] <= MAX ( 'Table1'[Date] ) )
)

2. If you don't have a date table, you can try this one.

Measure =
CALCULATE (
    SUM ( Table1[Value] ),
    FILTER (
        ALL ( Table1 ),
        'Table1'[Date] <= MAX ( 'Table1'[Date] )
            && 'Table1'[Vendor] = MIN ( 'Table1'[Vendor] )
    )
)

Issue-calculating-Running-total-by-columns

Best Regards,
Dale

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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