Forum Discussion
Anonymous
5 years agoNot applicable
Cumulative Query Summary - Is it possible?
Good Morning Power BI Community, I have a business need that I am looking to fill and was wondering if this is possible in Power BI & Power Query. Basically I have a query that is run on a d...
Bohumil_Uhrin
5 years agoHelper II
Hi Anonymous, you can use group function for this task.
Assuming, you have date as a first column, you can remove "invoice number" column, and then group by date and customer, using sum as aggregation function, for each value column.
let
Source = Excel.Workbook(File.Contents("path to excel file"), null, true),
Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),
#"Removed Columns" = Table.RemoveColumns(#"Promoted Headers",{"Invoice Number"}),
#"Grouped Rows" = Table.Group(#"Removed Columns", {"Date", "Customer"}, {{"Invoice Amount", each List.Sum([Invoice Amount]), type number}, {"Current Amount", each List.Sum([Current Amount]), type nullable number}, {"1-14 Days late", each List.Sum([#"1-14 Days late"]), type nullable number}, {"15-29 Days late", each List.Sum([#"15-29 Days late"]), type nullable number}, {"30-59 Days late", each List.Sum([#"30 - 59 Days late"]), type nullable number}, {"60 or more days late", each List.Sum([60 or more days late]), type nullable number}})
in
#"Grouped Rows"