Forum Discussion
sunil3M
6 years agoNew Member
SUMIF function
this is the formula i use in excel SUMIF($P$2:P17,P17,$AF$2:AF17) want to replicae the same in power bi can some one share me easy coding for the same below is the data from excel and Order qty co...
- 6 years ago
Hi sunil3M ,
Power query could also do it.
You could create an index column and a "RunningTotal" function in query editor.
= ( tbl as table, sumcolumn as text, rowindex as number) => let #"Removed Columns" = Table.RemoveColumns(tbl,{"SKU #"}), #"Filtered Rows" = Table.SelectRows(#"Removed Columns", each [Index] <= rowindex), #"Renamed Columns" = Table.RenameColumns(#"Filtered Rows",{{sumcolumn, "Temp"}}), #"Grouped Rows" = Table.Group(#"Renamed Columns", {}, {{"RunningTotal", each List.Sum([Temp]), type number}}), RunningTotal = Record.Field(#"Grouped Rows"{0},"RunningTotal") in RunningTotalThen use it to add a new column
= Table.AddColumn(#"Removed Columns", "Custom", each TotalRunning(#"Removed Columns","BACK QTY",[Index]))You could get more details from this link:
https://www.excelguru.ca/blog/2015/03/31/create-running-totals-in-power-query/
Here is my test file for your reference.
sunil3M
6 years agoNew Member