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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Marco0984
Frequent Visitor

Running Total

Hi all

 

I realy need some help. I dont get further with that. I need a running total by account (Sachkonto).

Any idea how to get that?

 

 

let
Quelle = PowerPlatform.Dataflows(null),
Workspaces = Quelle{[Id="Workspaces"]}[Data],
#"a78f6ff6-16c8-4217-964c-890d7efc35d6" = Workspaces{[workspaceId="a78f6ff6-16c8-4217-964c-890d7efc35d6"]}[Data],
#"b069a036-9cd2-4eef-a6af-e4134142bcce" = #"a78f6ff6-16c8-4217-964c-890d7efc35d6"{[dataflowId="b069a036-9cd2-4eef-a6af-e4134142bcce"]}[Data],
Salden_ = #"b069a036-9cd2-4eef-a6af-e4134142bcce"{[entity="Salden",version=""]}[Data],
#"Gefilterte Zeilen" = Table.SelectRows(Salden_, each ([Währungstyp Stufe 01] = "Währung des Buchungskreises") and ([Ledger Stufe 01] = "führendes Ledger")),
#"Entfernte Spalten" = Table.RemoveColumns(#"Gefilterte Zeilen",{"Key", "Währungstyp Stufe 01", "Ledger Stufe 01"}),
#"Geänderter Typ" = Table.TransformColumnTypes(#"Entfernte Spalten",{{"Datum", type date}}),
#"Sortierte Zeilen" = Table.Sort(#"Geänderter Typ",{{"Sachkonto Stufe 01.Schlüssel (nicht geklammert)", Order.Ascending}, {"Datum", Order.Ascending}}),
#"Umbenannte Spalten" = Table.RenameColumns(#"Sortierte Zeilen",{{"Sachkonto Stufe 01.Schlüssel (nicht geklammert)", "Sachkonto"}, {"Summe", "Betrag"}}),
#"Zusammengeführte Abfragen" = Table.NestedJoin(#"Umbenannte Spalten", {"Datum"}, DIMKalender, {"Datum"}, "DIMKalender", JoinKind.LeftOuter),
#"Erweiterte DIMKalender" = Table.ExpandTableColumn(#"Zusammengeführte Abfragen", "DIMKalender", {"Geschäftsjahr"}, {"DIMKalender.Geschäftsjahr"}),
#"Neu angeordnete Spalten" = Table.ReorderColumns(#"Erweiterte DIMKalender",{"Sachkonto", "Datum", "DIMKalender.Geschäftsjahr", "Betrag"}),
#"Umbenannte Spalten1" = Table.RenameColumns(#"Neu angeordnete Spalten",{{"DIMKalender.Geschäftsjahr", "Geschäftsjahr"}}),
#"Neu angeordnete Spalten1" = Table.ReorderColumns(#"Umbenannte Spalten1",{"Sachkonto", "Geschäftsjahr", "Datum", "Betrag"}),
#"Entfernte Spalten1" = Table.RemoveColumns(#"Neu angeordnete Spalten1",{"Geschäftsjahr"}),
MainData = Table.Sort(#"Entfernte Spalten1",{{"Sachkonto", Order.Ascending}, {"Datum", Order.Ascending}}),
#"Hinzugefügter Index" = Table.AddIndexColumn(MainData, "Index", 1, 1, Int64.Type),
BufferedValue = List.Buffer(#"Hinzugefügter Index"[Betrag]),
RunningTotalList = List.Generate (
() => [RunningTotal = BufferedValue{0}, Counter = 0 ],

each [Counter] < List.Count( BufferedValue),
each [ RunningTotal = [RunningTotal] + BufferedValue{[Counter] + 1}, Counter = [Counter] +1],
each [RunningTotal]
),
Benutzerdefiniert1 = Table.FromColumns(
Table.ToColumns(MainData) & {RunningTotalList},
Table.ColumnNames (MainData)&{"RunningTotals"}
)
in
Benutzerdefiniert1

1 REPLY 1
DataNinja777
Super User
Super User

Hi @Marco0984 ,

 

You can create a running total by account in a simple manner using dax.  You just need to bring in your fact table as it is in your data model and then created a relationship with your mapping table (Chart of Accounts), and then do the running total formula  If you can paste the example of the fields in your data model, you will be able to get the dax formula more quickly from community members. 

Best regards,

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.