min and max date

Imran Azam

Board Regular
Joined
Mar 15, 2011
Messages
103
HI GUYS,

I am trying to get the min and max date for a customer from the data below


Nameitemqtystart dateend date
AlanS3
01/09/2013

<tbody>
</tbody>
31/12/2014
AlanS501/11/201531/12/2016
AlanS2
01/01/2016

<tbody>
</tbody>
31/12/2017

<tbody>
</tbody>

i want so show the below

which is the name the item , sum of qty and min start date and max end date


NameitemQTYstart dateend date
AlanS10
01/09/2013

<tbody>
</tbody>
31/12/2017

<tbody>
</tbody>


how can i get the min and max dates?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
with PowerQuery (Get&Transform)

Nameitemqtystart dateend dateNameitemqtyMin dateMax date
AlanS
3​
01/09/2013​
31/12/2014​
AlanS
10​
01/09/2013​
31/12/2017​
AlanS
5​
01/11/2015​
31/12/2016​
AlanS
2​
01/01/2016​
31/12/2017​

Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"item", type text}, {"qty", Int64.Type}, {"start date", type date}, {"end date", type date}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Name", "item"}, {{"qty", each List.Sum([qty]), type number}, {"Min date", each List.Min([start date]), type date}, {"Max date", each List.Max([end date]), type date}})
in
    #"Grouped Rows"[/SIZE]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

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