Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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 column is the column were i use this formula.
based on the SKU need to sum the value
| SKU # | BACK QTY | Order Qty |
| IA110123493 | 460 | 460 |
| IA110123493 | 5000 | 5460 |
| IA110123493 | 5000 | 10460 |
| IA110123493 | 1500 | 11960 |
| IA110123493 | 2000 | 13960 |
| IA110123493 | 500 | 14460 |
| IA110123493 | 1600 | 16060 |
| IA110123493 | 1000 | 17060 |
Solved! Go to Solution.
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
RunningTotal
Then 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.
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
RunningTotal
Then 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.
first, create an Index column in Power Query then create a calculated column
Order Qty =
CALCULATE(
SUM(Table[SKU #]),
FILTER(ALL(Table), Table[SKU #] = EARLIER(Table[SKU #]) && Table[Index] <= EARLIER(Table[Index]))
)
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 46 | |
| 43 | |
| 39 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 65 | |
| 31 | |
| 28 | |
| 24 |