I'm writing some month over month aggregations for the value column.
I've written the monthly cumulative function without too much trouble:
Table.AddColumn(#"Sorted Rows1", "Cumulative Value", each List.Sum(
Table.SelectRows(
#"Sorted Rows1",
(x) => x[Month Start] <= [Month Start]
)
[Value]), type number)
But am running into difficulties creating the MOM aggregation with the region included.
Table.AddColumn(#"Added Custom2", "Property Region Cumulative Value", each List.Sum(
Table.SelectRows(
#"Added Custom2", each
(x) => x[Month Start] <= [Month Start]
,(x) => x[Property Region] = [Property Region]
)
[Value]))
Any ideas on how to rewrite the criteria syntax to achieve the correct result?
This works fine (though your desired output seems wrong)
let Source = Excel.CurrentWorkbook(){[Name="Table4"]}[Content],
#"Sorted Rows1" = Table.TransformColumnTypes(Source,{ {"Value", type number}}),
#"Added Custom1" = Table.AddColumn( #"Sorted Rows1","Cumulative Value",(x)=>List.Sum(Table.SelectRows( #"Sorted Rows1", each [Month Start] <= x[Month Start] and x[Property Region] = [Property Region])[Value]))
in #"Added Custom1"