• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Sumifs based on Date

Joe Shaer

New Member
Dear all,

I would like to add 'total price' based on date criteria based on Month & Year.

I figured a way to do it but was wondering if there is an easier formula to work with. Please see attachment.
83006
Any help would be appreciated.

Thanks
Joe
 

Attachments

Power Query

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Sales_Data3"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"OrderDate", type date}, {"Region", type text}, {"City", type text}, {"Category", type text}, {"Product", type text}, {"Quantity", Int64.Type}, {"UnitPrice", type number}, {"TotalPrice", type number}}),
    #"Inserted Year" = Table.AddColumn(#"Changed Type", "Year", each Date.Year([OrderDate]), Int64.Type),
    #"Inserted Month" = Table.AddColumn(#"Inserted Year", "Month", each Date.Month([OrderDate]), Int64.Type),
    #"Grouped Rows" = Table.Group(#"Inserted Month", {"Year", "Month"}, {{"Total", each List.Sum([TotalPrice]), type nullable number}}),
    #"Sorted Rows" = Table.Sort(#"Grouped Rows",{{"Year", Order.Ascending}, {"Month", Order.Ascending}})
in
    #"Sorted Rows"
 

Attachments

Back
Top