How to sum cost in a day with counting duplicate entry once only?

PBI0311

New Member
Joined
Nov 12, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi guys,

I'd like to get some enlightenment on how to solve the following question.

I need to sum my daily delivery to different countries as shown below, however, for example like UK got more than once shipment in a day but I only count once if it happened in a same day. Hope to get some advices here :)

Screenshot_20211112-194728.jpg
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Can be solved using Power Query. 3 Queriies as follows.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}),
    #"Removed Duplicates" = Table.Distinct(#"Changed Type", {"Date", "Country"}),
    #"Grouped Rows" = Table.Group(#"Removed Duplicates", {"Date"}, {{"Total Cost", each List.Sum([Del Cost]), type number}})
in
    #"Grouped Rows"

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}),
    #"Removed Duplicates" = Table.Distinct(#"Changed Type", {"Date", "Country"}),
    #"Extracted Month Name" = Table.TransformColumns(#"Removed Duplicates", {{"Date", each Date.MonthName(_), type text}}),
    #"Grouped Rows" = Table.Group(#"Extracted Month Name", {"Date"}, {{"Total Cost By Month", each List.Sum([Del Cost]), type number}})
in
    #"Grouped Rows"

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}),
    #"Removed Duplicates" = Table.Distinct(#"Changed Type", {"Date", "Country"})
in
    #"Removed Duplicates"

Book4
ABCDEFGHIJKLM
1DateCountryDel CostDateTotal CostDateTotal Cost By MonthDateCountryDel Cost
21-JanUK1001/1/2021180January2801/1/2021UK100
31-JanUK1001/2/20211001/1/2021Germany50
41-JanGermany501/1/2021Japan30
51-JanJapan301/2/2021UK100
62-JanUK100
Sheet1
 
Upvote 0

Forum statistics

Threads
1,223,693
Messages
6,173,868
Members
452,536
Latest member
Chiz511

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top