I am working with Power BI tables and I am not being able to calculate balance "Running total" like I need.
I was searching in Stack Overflow and other webpages and I always find the same solution for a very similar situation, which is not this.
First of all, this is my table:
I found in this and other sites the same solution:
Running Total COLUMN =
CALCULATE (
SUM ( 'My table'[Accounting Balance] ),
ALL ( 'My table' ),
'My table'[Date] <= EARLIER ( 'My table'[Date] ))
This would work whenever I need to sum the rows vertically, which is not my case. Indeed, I need to sum the valu horizontally:
Any suggestions?
Edit 1:
This is what I need:
So if you take a close look to this table it has the resulting calculation of each column for each vendor like:
This is done in Power Query as I don't have BI, but I assume the M-Code will work just as well. It will also auto adjust if you refresh the query as you add/delete columns, so there is no need to reference each column individually.
You add a Custom Column which sums all the columns except the "Vendor/Month"
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Vendor/Month", type text}, {"Jan-17", Int64.Type}, {"Feb-17", Int64.Type}, {"Mar-17", Int64.Type}, {"Apr-17", Int64.Type}}),
#"Sum" = Table.AddColumn(
#"Changed Type",
"Total",
each List.Sum(
Record.ToList(
Record.SelectFields(
_,
List.RemoveItems(Table.ColumnNames(#"Changed Type"), {"Vendor/Month"})))))
in
#"Sum"
This is the Custom Column Dialog:
And this is the result: