Forum Discussion
Need Help on sumif & Countif
- 2 years ago
KuntalSingh, go ahead and try it, and if you hit any snags, just reach out.
in power query, create a new column= Table.AddColumn(YourTableName, "ConcatenatedColumn", each [A] & Number.ToText(Number.Abs([B])))SUMIF:
let GroupedTable = Table.Group(YourTableName, {"C"}, {{"SumColumn", each List.Sum([B]), type number}}), MergedTable = Table.NestedJoin(YourTableName, {"C"}, GroupedTable, {"C"}, "MergedColumn", JoinKind.LeftOuter), ExpandedTable = Table.ExpandTableColumn(MergedTable, "MergedColumn", {"SumColumn"}, {"SumColumn"}) in ExpandedTableCOUNTIF:
let GroupedTable = Table.Group(YourTableName, {"C"}, {{"CountColumn", each Table.RowCount(_), Int64.Type}}), MergedTable = Table.NestedJoin(YourTableName, {"C"}, GroupedTable, {"C"}, "MergedColumn", JoinKind.LeftOuter), ExpandedTable = Table.ExpandTableColumn(MergedTable, "MergedColumn", {"CountColumn"}, {"CountColumn"}) in ExpandedTableCOUNTIF MR8M:
= Table.AddColumn(YourTableName, "CountMR8M", each if [D] = "MR8M" then 1 else 0)sum count
let SummedTable = Table.Group(YourTableName, {}, {{"TotalMR8M", each List.Sum([CountMR8M]), type number}}) in SummedTable:in power query create custom column:
= Table.AddColumn(YourTableName, "Condition1", each if [D] = 3 and [E] > 1 then "True" else "False")create custom column
= Table.AddColumn(YourTableName, "Condition2", each if Number.Mod([B], 2) = 0 and [F] = 0 and [G] = 0 then "True" else "False")Did I answer your question? If so, please mark my post as the solution!
Your Kudos are much appreciated! Proud to be a Resolver III !
I've made a start in the linked-to workbook below using the data in your last reply.
There's a Power Query query table at cell AI3.
Curious that some date columns are UK-style dates and others US-style dates!
Your data has been grouped by the first 2 columns. There's only F-44 Clearing in the Comment column because no other comment applies in your data.
The workbook: https://app.box.com/s/qv411rzbbntw4bt9be6h81x7ihgyk1hr
Thanks for kind help
Can you please give me M code for the same
- p45cal2 years agoSolution Supplier
It's in the linked-to workbook at the end of my last message.