Is it possible to filter to the latest date of each month?

bleeet

Board Regular
Joined
May 11, 2009
Messages
208
Office Version
  1. 2013
Platform
  1. Windows
Hi Everyone,


I have a little issue. I have a large data set of project entries and some of them have more than one entry in a month and that only the numbers from the latest day of that month are counted.

so for example this month in the date column. a project has entries from 2021-10-18 and 2021-10-29. I want to be able to filter for only the latest day in each month so the 2021-10-29 entries.

Is this possible? if so how do I do that in power query?
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
How about this?

Book1
ABCDE
1DateValueDateValue
210/26/20215110/26/202151
311/10/20218811/25/202197
411/25/20219712/25/202148
512/10/2021771/24/202292
612/25/2021482/23/202296
71/9/2022153/25/202221
81/24/2022924/24/202215
92/8/2022575/24/202261
102/23/2022966/23/202269
113/10/2022507/23/202278
123/25/2022218/7/202218
134/9/202275
144/24/202215
155/9/202287
165/24/202261
176/8/202295
186/23/202269
197/8/20228
207/23/202278
218/7/202218
Sheet3


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Month = Table.AddColumn(Source, "Month", each Date.Month([Date])),
    Group = Table.Group(Month, {"Month"}, {{"Count", each _, type table [Date=datetime, Value=number, Month=number]}}),
    SR = Table.TransformColumns(Group,{{"Count", (tbl)=>
        let 
            MD = List.Max(tbl[Date]),
            Sel = Table.SelectRows(tbl, each _[Date]=MD)
        in
            Sel
    }}),
    Expand = Table.ExpandTableColumn(SR, "Count", {"Date", "Value"}, {"Date", "Value"}),
    RC = Table.RemoveColumns(Expand,{"Month"})
in
    RC
 
Upvote 0
How about this?

Book1
ABCDE
1DateValueDateValue
210/26/20215110/26/202151
311/10/20218811/25/202197
411/25/20219712/25/202148
512/10/2021771/24/202292
612/25/2021482/23/202296
71/9/2022153/25/202221
81/24/2022924/24/202215
92/8/2022575/24/202261
102/23/2022966/23/202269
113/10/2022507/23/202278
123/25/2022218/7/202218
134/9/202275
144/24/202215
155/9/202287
165/24/202261
176/8/202295
186/23/202269
197/8/20228
207/23/202278
218/7/202218
Sheet3


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Month = Table.AddColumn(Source, "Month", each Date.Month([Date])),
    Group = Table.Group(Month, {"Month"}, {{"Count", each _, type table [Date=datetime, Value=number, Month=number]}}),
    SR = Table.TransformColumns(Group,{{"Count", (tbl)=>
        let
            MD = List.Max(tbl[Date]),
            Sel = Table.SelectRows(tbl, each _[Date]=MD)
        in
            Sel
    }}),
    Expand = Table.ExpandTableColumn(SR, "Count", {"Date", "Value"}, {"Date", "Value"}),
    RC = Table.RemoveColumns(Expand,{"Month"})
in
    RC

thanks but I have no idea how to add this to my query :(

might there be a way without using M language?
 
Upvote 0
I'm not sure what you mean. Everything in PowerQuery is driven by M. It might be useful if you would post a sample of your data using the XL2BB add-in provided by this forum. It would also be useful if you would update your profile so we know what version of Excel you're working with.

Having said that, here are a couple more ways

Here is another way using PQ that can be done just using the tools in the ribbon and not having to write any M manually.

Book1
ABCDEFGHIJK
1DateValueDateValueDateValueDateValue
210/26/20215110/26/20215110/26/20215110/26/202151
311/10/20218811/25/20219711/25/20219711/10/202188
411/25/20219712/25/20214812/25/20214812/10/202177
512/10/2021771/24/2022921/24/2022921/9/202215
612/25/2021482/23/2022962/23/2022962/8/202257
71/9/2022153/25/2022213/25/2022213/10/202250
81/24/2022924/24/2022154/24/2022154/9/202275
92/8/2022575/24/2022615/24/2022615/9/202287
102/23/2022966/23/2022696/23/2022696/8/202295
113/10/2022507/23/2022787/23/2022787/8/20228
123/25/2022218/7/2022188/7/2022188/7/202218
134/9/202275
144/24/202215
155/9/202287
165/24/202261
176/8/202295
186/23/202269
197/8/20228
207/23/202278
218/7/202218
Sheet3


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Month = Table.AddColumn(Source, "Month", each Date.Month([Date])),
    Group = Table.Group(Month, {"Month"}, {{"Last", each List.Max([Date]), type datetime}, {"Data", each _, type table [Date=datetime, Value=number, Month=number]}}),
    Expand = Table.ExpandTableColumn(Group, "Data", {"Date", "Value"}, {"Date", "Value"}),
    TF = Table.AddColumn(Expand, "Custom", each [Last]=[Date]),
    Filter = Table.SelectRows(TF, each ([Custom] = true)),
    RC = Table.RemoveColumns(Filter,{"Month", "Last", "Custom"})
in
    RC

And here is a way using VBA if you'd rather.

VBA Code:
Sub BLEET()
Dim AR() As Variant:        AR = Range("A2:B" & Range("A" & Rows.Count).End(xlUp).Row).Value2
Dim r As Range:             Set r = Range("L1")

With CreateObject("Scripting.Dictionary")
    For i = 1 To UBound(AR)
        If Not .exists(Month(AR(i, 1))) Then
            .Add Month(AR(i, 1)), Join(Array(AR(i, 1), AR(i, 2)), ",")
        Else
            If Split(.Item(Month(AR(i, 1))), ",")(0) < AR(i, 1) Then .Item(Month(AR(i, 1))) = Join(Array(AR(i, 1), AR(i, 2)), ",")
        End If
    Next i
    Set r = Range("L2").Resize(.Count)
    r.Value2 = Application.Transpose(.items)
    r.TextToColumns DataType:=xlDelimited, Comma:=True
End With
End Sub
 
Upvote 0
I'm not sure what you mean. Everything in PowerQuery is driven by M. It might be useful if you would post a sample of your data using the XL2BB add-in provided by this forum. It would also be useful if you would update your profile so we know what version of Excel you're working with.

Having said that, here are a couple more ways

Here is another way using PQ that can be done just using the tools in the ribbon and not having to write any M manually.

Book1
ABCDEFGHIJK
1DateValueDateValueDateValueDateValue
210/26/20215110/26/20215110/26/20215110/26/202151
311/10/20218811/25/20219711/25/20219711/10/202188
411/25/20219712/25/20214812/25/20214812/10/202177
512/10/2021771/24/2022921/24/2022921/9/202215
612/25/2021482/23/2022962/23/2022962/8/202257
71/9/2022153/25/2022213/25/2022213/10/202250
81/24/2022924/24/2022154/24/2022154/9/202275
92/8/2022575/24/2022615/24/2022615/9/202287
102/23/2022966/23/2022696/23/2022696/8/202295
113/10/2022507/23/2022787/23/2022787/8/20228
123/25/2022218/7/2022188/7/2022188/7/202218
134/9/202275
144/24/202215
155/9/202287
165/24/202261
176/8/202295
186/23/202269
197/8/20228
207/23/202278
218/7/202218
Sheet3


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Month = Table.AddColumn(Source, "Month", each Date.Month([Date])),
    Group = Table.Group(Month, {"Month"}, {{"Last", each List.Max([Date]), type datetime}, {"Data", each _, type table [Date=datetime, Value=number, Month=number]}}),
    Expand = Table.ExpandTableColumn(Group, "Data", {"Date", "Value"}, {"Date", "Value"}),
    TF = Table.AddColumn(Expand, "Custom", each [Last]=[Date]),
    Filter = Table.SelectRows(TF, each ([Custom] = true)),
    RC = Table.RemoveColumns(Filter,{"Month", "Last", "Custom"})
in
    RC

And here is a way using VBA if you'd rather.

VBA Code:
Sub BLEET()
Dim AR() As Variant:        AR = Range("A2:B" & Range("A" & Rows.Count).End(xlUp).Row).Value2
Dim r As Range:             Set r = Range("L1")

With CreateObject("Scripting.Dictionary")
    For i = 1 To UBound(AR)
        If Not .exists(Month(AR(i, 1))) Then
            .Add Month(AR(i, 1)), Join(Array(AR(i, 1), AR(i, 2)), ",")
        Else
            If Split(.Item(Month(AR(i, 1))), ",")(0) < AR(i, 1) Then .Item(Month(AR(i, 1))) = Join(Array(AR(i, 1), AR(i, 2)), ",")
        End If
    Next i
    Set r = Range("L2").Resize(.Count)
    r.Value2 = Application.Transpose(.items)
    r.TextToColumns DataType:=xlDelimited, Comma:=True
End With
End Sub
I mean that I use the ribbon to do most of the stuff and do not write the code to do things in power query.

I am a little lost reading the code :(

apologies I am using excel 2013
 
Upvote 0
I mean that I use the ribbon to do most of the stuff and do not write the code to do things in power query.

This is what the second PQ code was doing.

I added a custom column with the formula Date.Month([Date])
Grouped on the month column, with one aggregation being Max of date (Column named 'Last'), and the other being All Rows.
Added another custom column that checks if [Date]=[Last]
Then filter that custom columns to only show True.
Then finally just removing the unneeded columns.
 
Upvote 0
This is what the second PQ code was doing.

I added a custom column with the formula Date.Month([Date])
Grouped on the month column, with one aggregation being Max of date (Column named 'Last'), and the other being All Rows.
Added another custom column that checks if [Date]=[Last]
Then filter that custom columns to only show True.
Then finally just removing the unneeded columns.
thanks but I believe I did not describe the issue right or I maybe I am doing this wrong because I am getting the last date for each project which is sometime next year. I want the last date in each month

I attached a sample set for one project which is the example I mentioned I want to grab the latest date in each month so oct 29 in this sample data. only the planned amount in that is going to be counted. Sorry I cannot add the L2bb is blocked on my end. I am want filter the plannnedstartdate to the latest date of each month. this project and entries for each month throughout the year. The ProjectWorkID is the project name

ProjectWorkIDPlannedAmountPlannedStartDatePlannedFinishDate
4389-65
39280.52​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
5086.7​
2021/10/182021/10/18
4389-65
1714.94​
2021/10/182021/10/18
4389-65
7861.26​
2021/10/182021/10/18
4389-65
42389.14​
2021/10/182021/10/18
4389-65
3595.1​
2021/10/292021/10/29
4389-65
6772.41​
2021/10/292021/10/29
4389-65
697.19​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
685.9​
2021/10/182021/10/18
4389-65
21194.57​
2021/10/182021/10/18
4389-65
42389.14​
2021/10/182021/10/18
4389-65
42389.14​
2021/10/182021/10/18
4389-65
2620.42​
2021/10/182021/10/18
4389-65
5809.92​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
5809.92​
2021/10/182021/10/18
4389-65
2870.38​
2021/10/182021/10/18
4389-65
2543.35​
2021/10/182021/10/18
4389-65
6340.89​
2021/10/292021/10/29
4389-65
5086.7​
2021/10/182021/10/18
4389-65
13288.8​
2021/10/182021/10/18
4389-65
-4544.42​
2021/10/182021/10/18
4389-65
-1488.35​
2021/10/182021/10/18
4389-65
1610.6​
2021/10/182021/10/18
4389-65
21194.57​
2021/10/182021/10/18
4389-65
869.83​
2021/10/182021/10/18
4389-65
685.9​
2021/10/182021/10/18
4389-65
17718.4​
2021/10/182021/10/18
4389-65
91560.55​
2021/10/182021/10/18
4389-65
2543.35​
2021/10/182021/10/18
4389-65
760.91​
2021/10/292021/10/29
4389-65
42389.14​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
740​
2021/10/292021/10/29
4389-65
1507.87​
2021/10/182021/10/18
4389-65
5715.81​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
12565.6​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
-321.48​
2021/10/182021/10/18
4389-65
42389.14​
2021/10/182021/10/18
4389-65
-538.91​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
5809.92​
2021/10/182021/10/18
4389-65
6809.69​
2021/10/182021/10/18
4389-65
5086.7​
2021/10/182021/10/18
4389-65
348.6​
2021/10/182021/10/18
4389-65
5715.81​
2021/10/182021/10/18
4389-65
685.9​
2021/10/182021/10/18
4389-65
-545.33​
2021/10/182021/10/18
4389-65
2870.38​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
23919.84​
2021/10/182021/10/18
4389-65
5809.92​
2021/10/182021/10/18
4389-65
1610.6​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
-1503.23​
2021/10/182021/10/18
4389-65
42389.14​
2021/10/182021/10/18
4389-65
3271.35​
2021/10/182021/10/18
4389-65
2126.21​
2021/10/182021/10/18
4389-65
-641.57​
2021/10/182021/10/18
4389-65
685.9​
2021/10/182021/10/18
4389-65
2391.98​
2021/10/182021/10/18
4389-65
-180.39​
2021/10/182021/10/18
4389-65
56436.74​
2021/10/292021/10/29
4389-65
0​
2021/10/182021/10/18
4389-65
23919.84​
2021/10/182021/10/18
4389-65
10918.41​
2021/10/182021/10/18
4389-65
42389.14​
2021/10/182021/10/18
4389-65
-2315.07​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
65510.5​
2021/10/182021/10/18
4389-65
-321.48​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
4713.66​
2021/10/182021/10/18
4389-65
5728.26​
2021/10/182021/10/18
4389-65
4713.66​
2021/10/182021/10/18
4389-65
1521.81​
2021/10/182021/10/18
4389-65
39280.52​
2021/10/182021/10/18
4389-65
23919.84​
2021/10/182021/10/18
4389-65
-180.39​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
629​
2021/10/292021/10/29
4389-65
5086.7​
2021/10/182021/10/18
4389-65
12681.79​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
13421.69​
2021/10/182021/10/18
4389-65
5086.7​
2021/10/182021/10/18
4389-65
5715.81​
2021/10/182021/10/18
4389-65
697.19​
2021/10/182021/10/18
4389-65
23919.84​
2021/10/182021/10/18
4389-65
65510.49​
2021/10/182021/10/18
4389-65
7861.26​
2021/10/182021/10/18
4389-65
48041.02​
2021/10/182021/10/18
4389-65
2908.62​
2021/10/182021/10/18
4389-65
-277.81​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
-277.81​
2021/10/182021/10/18
4389-65
1304.47​
2021/10/182021/10/18
4389-65
3271.35​
2021/10/182021/10/18
4389-65
-2315.07​
2021/10/182021/10/18
4389-65
2870.38​
2021/10/182021/10/18
4389-65
697.19​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
65510.5​
2021/10/182021/10/18
4389-65
5086.7​
2021/10/182021/10/18
4389-65
47735.52​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
5764.92​
2021/10/182021/10/18
4389-65
5809.92​
2021/10/182021/10/18
4389-65
817.16​
2021/10/182021/10/18
4389-65
5086.7​
2021/10/182021/10/18
4389-65
1594.66​
2021/10/182021/10/18
4389-65
84778.29​
2021/10/182021/10/18
4389-65
1610.6​
2021/10/182021/10/18
4389-65
14291.13​
2021/10/182021/10/18
4389-65
3013.48​
2021/10/182021/10/18
4389-65
869.83​
2021/10/182021/10/18
4389-65
23919.84​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
-1503.23​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
2904.96​
2021/10/182021/10/18
4389-65
65510.49​
2021/10/182021/10/18
4389-65
5086.7​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
13421.69​
2021/10/182021/10/18
4389-65
7248.57​
2021/10/182021/10/18
4389-65
685.9​
2021/10/182021/10/18
4389-65
392.56​
2021/10/182021/10/18
4389-65
42389.14​
2021/10/182021/10/18
4389-65
10987.27​
2021/10/182021/10/18
4389-65
14291.13​
2021/10/182021/10/18
4389-65
1610.6​
2021/10/182021/10/18
4389-65
10735​
2021/10/182021/10/18
4389-65
42389.14​
2021/10/182021/10/18
4389-65
5308.74​
2021/10/182021/10/18
4389-65
685.9​
2021/10/182021/10/18
4389-65
23919.84​
2021/10/182021/10/18
4389-65
7248.57​
2021/10/182021/10/18
4389-65
24238.5​
2021/10/182021/10/18
4389-65
5243​
2021/10/292021/10/29
4389-65
392.56​
2021/10/182021/10/18
4389-65
21836.83​
2021/10/182021/10/18
4389-65
20532.95​
2021/10/292021/10/29
4389-65
697.19​
2021/10/182021/10/18
4389-65
697.19​
2021/10/182021/10/18
4389-65
7861.26​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
685.9​
2021/10/182021/10/18
4389-65
2463.95​
2021/10/292021/10/29
4389-65
5715.81​
2021/10/182021/10/18
4389-65
23919.84​
2021/10/182021/10/18
4389-65
1041.41​
2021/10/182021/10/18
4389-65
19933.2​
2021/10/182021/10/18
4389-65
2870.38​
2021/10/182021/10/18
4389-65
-2679.02​
2021/10/182021/10/18
4389-65
5715.81​
2021/10/182021/10/18
4389-65
81303.84​
2021/10/182021/10/18
4389-65
42389.14​
2021/10/182021/10/18
4389-65
10173.39​
2021/10/182021/10/18
4389-65
5086.7​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
2870.38​
2021/10/182021/10/18
4389-65
5715.81​
2021/10/182021/10/18
4389-65
-4490.96​
2021/10/182021/10/18
4389-65
-267.9​
2021/10/182021/10/18
4389-65
5086.7​
2021/10/182021/10/18
4389-65
-5346.38​
2021/10/182021/10/18
4389-65
13421.69​
2021/10/182021/10/18
4389-65
2870.38​
2021/10/182021/10/18
4389-65
42389.14​
2021/10/182021/10/18
4389-65
1310.21​
2021/10/182021/10/18
4389-65
1714.94​
2021/10/182021/10/18
4389-65
1310.21​
2021/10/182021/10/18
4389-65
5715.81​
2021/10/182021/10/18
4389-65
-2679.02​
2021/10/182021/10/18
4389-65
13421.69​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
5086.7​
2021/10/182021/10/18
4389-65
431.41​
2021/10/292021/10/29
4389-65
44239.5​
2021/10/182021/10/18
4389-65
5086.7​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
21836.83​
2021/10/182021/10/18
4389-65
10870.6​
2021/10/182021/10/18
4389-65
0​
2021/10/182021/10/18
4389-65
90​
2021/10/292021/10/29
4389-65
25112.35​
2021/10/182021/10/18
4389-65
1288.2​
2021/10/182021/10/18
4389-65
9756.46​
2021/10/182021/10/18
4389-65
5086.7​
2021/10/182021/10/18
4389-65
7861.26​
2021/10/182021/10/18
4389-65
2620.42​
2021/10/182021/10/18
4389-65
42389.14​
2021/10/182021/10/18
4389-65
-2232.52​
2021/10/182021/10/18
4389-65
2870.38​
2021/10/182021/10/18
4389-65
-178.6​
2021/10/182021/10/18
4389-65
8678.4​
2021/10/182021/10/18
4389-65
10918.41​
2021/10/182021/10/18
4389-65
42389.14​
2021/10/182021/10/18

 
Upvote 0
also there are hundreds of different projects in the database.
 
Upvote 0
Like this?

Book1
ABCDEFGHI
1ProjectWorkIDPlannedAmountPlannedStartDatePlannedFinishDateProjectWorkIDPlannedAmountPlannedStartDatePlannedFinishDate
24389-6539280.5210/18/202110/18/20214389-653595.110/29/202110/29/2021
34389-65010/18/202110/18/20214389-656772.4110/29/202110/29/2021
44389-655086.710/18/202110/18/20214389-656340.8910/29/202110/29/2021
54389-651714.9410/18/202110/18/20214389-65760.9110/29/202110/29/2021
64389-657861.2610/18/202110/18/20214389-6574010/29/202110/29/2021
74389-6542389.1410/18/202110/18/20214389-6556436.7410/29/202110/29/2021
84389-653595.110/29/202110/29/20214389-6562910/29/202110/29/2021
94389-656772.4110/29/202110/29/20214389-65524310/29/202110/29/2021
104389-65697.1910/18/202110/18/20214389-6520532.9510/29/202110/29/2021
114389-65010/18/202110/18/20214389-652463.9510/29/202110/29/2021
124389-65685.910/18/202110/18/20214389-65431.4110/29/202110/29/2021
134389-6521194.5710/18/202110/18/20214389-659010/29/202110/29/2021
144389-6542389.1410/18/202110/18/2021
154389-6542389.1410/18/202110/18/2021
164389-652620.4210/18/202110/18/2021
174389-655809.9210/18/202110/18/2021
184389-65010/18/202110/18/2021
194389-655809.9210/18/202110/18/2021
204389-652870.3810/18/202110/18/2021
214389-652543.3510/18/202110/18/2021
224389-656340.8910/29/202110/29/2021
234389-655086.710/18/202110/18/2021
244389-6513288.810/18/202110/18/2021
254389-65-4544.4210/18/202110/18/2021
264389-65-1488.3510/18/202110/18/2021
274389-651610.610/18/202110/18/2021
284389-6521194.5710/18/202110/18/2021
294389-65869.8310/18/202110/18/2021
304389-65685.910/18/202110/18/2021
314389-6517718.410/18/202110/18/2021
324389-6591560.5510/18/202110/18/2021
334389-652543.3510/18/202110/18/2021
344389-65760.9110/29/202110/29/2021
354389-6542389.1410/18/202110/18/2021
364389-65010/18/202110/18/2021
374389-6574010/29/202110/29/2021
384389-651507.8710/18/202110/18/2021
394389-655715.8110/18/202110/18/2021
404389-65010/18/202110/18/2021
414389-6512565.610/18/202110/18/2021
424389-65010/18/202110/18/2021
434389-65-321.4810/18/202110/18/2021
444389-6542389.1410/18/202110/18/2021
454389-65-538.9110/18/202110/18/2021
464389-65010/18/202110/18/2021
474389-655809.9210/18/202110/18/2021
484389-656809.6910/18/202110/18/2021
494389-655086.710/18/202110/18/2021
504389-65348.610/18/202110/18/2021
514389-655715.8110/18/202110/18/2021
524389-65685.910/18/202110/18/2021
534389-65-545.3310/18/202110/18/2021
544389-652870.3810/18/202110/18/2021
554389-65010/18/202110/18/2021
564389-65010/18/202110/18/2021
574389-6523919.8410/18/202110/18/2021
584389-655809.9210/18/202110/18/2021
594389-651610.610/18/202110/18/2021
604389-65010/18/202110/18/2021
614389-65-1503.2310/18/202110/18/2021
624389-6542389.1410/18/202110/18/2021
634389-653271.3510/18/202110/18/2021
644389-652126.2110/18/202110/18/2021
654389-65-641.5710/18/202110/18/2021
664389-65685.910/18/202110/18/2021
674389-652391.9810/18/202110/18/2021
684389-65-180.3910/18/202110/18/2021
694389-6556436.7410/29/202110/29/2021
704389-65010/18/202110/18/2021
714389-6523919.8410/18/202110/18/2021
724389-6510918.4110/18/202110/18/2021
734389-6542389.1410/18/202110/18/2021
744389-65-2315.0710/18/202110/18/2021
754389-65010/18/202110/18/2021
764389-6565510.510/18/202110/18/2021
774389-65-321.4810/18/202110/18/2021
784389-65010/18/202110/18/2021
794389-654713.6610/18/202110/18/2021
804389-655728.2610/18/202110/18/2021
814389-654713.6610/18/202110/18/2021
824389-651521.8110/18/202110/18/2021
834389-6539280.5210/18/202110/18/2021
844389-6523919.8410/18/202110/18/2021
854389-65-180.3910/18/202110/18/2021
864389-65010/18/202110/18/2021
874389-6562910/29/202110/29/2021
884389-655086.710/18/202110/18/2021
894389-6512681.7910/18/202110/18/2021
904389-65010/18/202110/18/2021
914389-6513421.6910/18/202110/18/2021
924389-655086.710/18/202110/18/2021
934389-655715.8110/18/202110/18/2021
944389-65697.1910/18/202110/18/2021
954389-6523919.8410/18/202110/18/2021
964389-6565510.4910/18/202110/18/2021
974389-657861.2610/18/202110/18/2021
984389-6548041.0210/18/202110/18/2021
994389-652908.6210/18/202110/18/2021
1004389-65-277.8110/18/202110/18/2021
1014389-65010/18/202110/18/2021
1024389-65-277.8110/18/202110/18/2021
1034389-651304.4710/18/202110/18/2021
1044389-653271.3510/18/202110/18/2021
1054389-65-2315.0710/18/202110/18/2021
1064389-652870.3810/18/202110/18/2021
1074389-65697.1910/18/202110/18/2021
1084389-65010/18/202110/18/2021
1094389-6565510.510/18/202110/18/2021
1104389-655086.710/18/202110/18/2021
1114389-6547735.5210/18/202110/18/2021
1124389-65010/18/202110/18/2021
1134389-655764.9210/18/202110/18/2021
1144389-655809.9210/18/202110/18/2021
1154389-65817.1610/18/202110/18/2021
1164389-655086.710/18/202110/18/2021
1174389-651594.6610/18/202110/18/2021
1184389-6584778.2910/18/202110/18/2021
1194389-651610.610/18/202110/18/2021
1204389-6514291.1310/18/202110/18/2021
1214389-653013.4810/18/202110/18/2021
1224389-65869.8310/18/202110/18/2021
1234389-6523919.8410/18/202110/18/2021
1244389-65010/18/202110/18/2021
1254389-65-1503.2310/18/202110/18/2021
1264389-65010/18/202110/18/2021
1274389-652904.9610/18/202110/18/2021
1284389-6565510.4910/18/202110/18/2021
1294389-655086.710/18/202110/18/2021
1304389-65010/18/202110/18/2021
1314389-6513421.6910/18/202110/18/2021
1324389-657248.5710/18/202110/18/2021
1334389-65685.910/18/202110/18/2021
1344389-65392.5610/18/202110/18/2021
1354389-6542389.1410/18/202110/18/2021
1364389-6510987.2710/18/202110/18/2021
1374389-6514291.1310/18/202110/18/2021
1384389-651610.610/18/202110/18/2021
1394389-651073510/18/202110/18/2021
1404389-6542389.1410/18/202110/18/2021
1414389-655308.7410/18/202110/18/2021
1424389-65685.910/18/202110/18/2021
1434389-6523919.8410/18/202110/18/2021
1444389-657248.5710/18/202110/18/2021
1454389-6524238.510/18/202110/18/2021
1464389-65524310/29/202110/29/2021
1474389-65392.5610/18/202110/18/2021
1484389-6521836.8310/18/202110/18/2021
1494389-6520532.9510/29/202110/29/2021
1504389-65697.1910/18/202110/18/2021
1514389-65697.1910/18/202110/18/2021
1524389-657861.2610/18/202110/18/2021
1534389-65010/18/202110/18/2021
1544389-65685.910/18/202110/18/2021
1554389-652463.9510/29/202110/29/2021
1564389-655715.8110/18/202110/18/2021
1574389-6523919.8410/18/202110/18/2021
1584389-651041.4110/18/202110/18/2021
1594389-6519933.210/18/202110/18/2021
1604389-652870.3810/18/202110/18/2021
1614389-65-2679.0210/18/202110/18/2021
1624389-655715.8110/18/202110/18/2021
1634389-6581303.8410/18/202110/18/2021
1644389-6542389.1410/18/202110/18/2021
1654389-6510173.3910/18/202110/18/2021
1664389-655086.710/18/202110/18/2021
1674389-65010/18/202110/18/2021
1684389-652870.3810/18/202110/18/2021
1694389-655715.8110/18/202110/18/2021
1704389-65-4490.9610/18/202110/18/2021
1714389-65-267.910/18/202110/18/2021
1724389-655086.710/18/202110/18/2021
1734389-65-5346.3810/18/202110/18/2021
1744389-6513421.6910/18/202110/18/2021
1754389-652870.3810/18/202110/18/2021
1764389-6542389.1410/18/202110/18/2021
1774389-651310.2110/18/202110/18/2021
1784389-651714.9410/18/202110/18/2021
1794389-651310.2110/18/202110/18/2021
1804389-655715.8110/18/202110/18/2021
1814389-65-2679.0210/18/202110/18/2021
1824389-6513421.6910/18/202110/18/2021
1834389-65010/18/202110/18/2021
1844389-655086.710/18/202110/18/2021
1854389-65431.4110/29/202110/29/2021
1864389-6544239.510/18/202110/18/2021
1874389-655086.710/18/202110/18/2021
1884389-65010/18/202110/18/2021
1894389-6521836.8310/18/202110/18/2021
1904389-6510870.610/18/202110/18/2021
1914389-65010/18/202110/18/2021
1924389-659010/29/202110/29/2021
1934389-6525112.3510/18/202110/18/2021
1944389-651288.210/18/202110/18/2021
1954389-659756.4610/18/202110/18/2021
1964389-655086.710/18/202110/18/2021
1974389-657861.2610/18/202110/18/2021
1984389-652620.4210/18/202110/18/2021
1994389-6542389.1410/18/202110/18/2021
2004389-65-2232.5210/18/202110/18/2021
2014389-652870.3810/18/202110/18/2021
2024389-65-178.610/18/202110/18/2021
2034389-658678.410/18/202110/18/2021
2044389-6510918.4110/18/202110/18/2021
2054389-6542389.1410/18/202110/18/2021
Sheet5


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Month = Table.AddColumn(Source, "Month", each Date.Month([PlannedFinishDate])),
    Group = Table.Group(Month, {"Month"}, {{"Data", each _, type table [ProjectWorkID=text, PlannedAmount=text, PlannedStartDate=datetime, PlannedFinishDate=datetime, Month=number]}}),
    SR = Table.TransformColumns(Group,{{"Data", (tbl)=>
        let 
            MD = List.Max(tbl[PlannedFinishDate]),
            Sel = Table.SelectRows(tbl, each _[PlannedFinishDate]=MD)
        in
            Sel
    }}),
    Expand = Table.ExpandTableColumn(SR, "Data", {"ProjectWorkID", "PlannedAmount", "PlannedStartDate", "PlannedFinishDate"}, {"ProjectWorkID", "PlannedAmount", "PlannedStartDate", "PlannedFinishDate"}),
    RC = Table.RemoveColumns(Expand,{"Month"})
in
    RC
 
Upvote 0
Like this?

Book1
ABCDEFGHI
1ProjectWorkIDPlannedAmountPlannedStartDatePlannedFinishDateProjectWorkIDPlannedAmountPlannedStartDatePlannedFinishDate
24389-6539280.5210/18/202110/18/20214389-653595.110/29/202110/29/2021
34389-65010/18/202110/18/20214389-656772.4110/29/202110/29/2021
44389-655086.710/18/202110/18/20214389-656340.8910/29/202110/29/2021
54389-651714.9410/18/202110/18/20214389-65760.9110/29/202110/29/2021
64389-657861.2610/18/202110/18/20214389-6574010/29/202110/29/2021
74389-6542389.1410/18/202110/18/20214389-6556436.7410/29/202110/29/2021
84389-653595.110/29/202110/29/20214389-6562910/29/202110/29/2021
94389-656772.4110/29/202110/29/20214389-65524310/29/202110/29/2021
104389-65697.1910/18/202110/18/20214389-6520532.9510/29/202110/29/2021
114389-65010/18/202110/18/20214389-652463.9510/29/202110/29/2021
124389-65685.910/18/202110/18/20214389-65431.4110/29/202110/29/2021
134389-6521194.5710/18/202110/18/20214389-659010/29/202110/29/2021
144389-6542389.1410/18/202110/18/2021
154389-6542389.1410/18/202110/18/2021
164389-652620.4210/18/202110/18/2021
174389-655809.9210/18/202110/18/2021
184389-65010/18/202110/18/2021
194389-655809.9210/18/202110/18/2021
204389-652870.3810/18/202110/18/2021
214389-652543.3510/18/202110/18/2021
224389-656340.8910/29/202110/29/2021
234389-655086.710/18/202110/18/2021
244389-6513288.810/18/202110/18/2021
254389-65-4544.4210/18/202110/18/2021
264389-65-1488.3510/18/202110/18/2021
274389-651610.610/18/202110/18/2021
284389-6521194.5710/18/202110/18/2021
294389-65869.8310/18/202110/18/2021
304389-65685.910/18/202110/18/2021
314389-6517718.410/18/202110/18/2021
324389-6591560.5510/18/202110/18/2021
334389-652543.3510/18/202110/18/2021
344389-65760.9110/29/202110/29/2021
354389-6542389.1410/18/202110/18/2021
364389-65010/18/202110/18/2021
374389-6574010/29/202110/29/2021
384389-651507.8710/18/202110/18/2021
394389-655715.8110/18/202110/18/2021
404389-65010/18/202110/18/2021
414389-6512565.610/18/202110/18/2021
424389-65010/18/202110/18/2021
434389-65-321.4810/18/202110/18/2021
444389-6542389.1410/18/202110/18/2021
454389-65-538.9110/18/202110/18/2021
464389-65010/18/202110/18/2021
474389-655809.9210/18/202110/18/2021
484389-656809.6910/18/202110/18/2021
494389-655086.710/18/202110/18/2021
504389-65348.610/18/202110/18/2021
514389-655715.8110/18/202110/18/2021
524389-65685.910/18/202110/18/2021
534389-65-545.3310/18/202110/18/2021
544389-652870.3810/18/202110/18/2021
554389-65010/18/202110/18/2021
564389-65010/18/202110/18/2021
574389-6523919.8410/18/202110/18/2021
584389-655809.9210/18/202110/18/2021
594389-651610.610/18/202110/18/2021
604389-65010/18/202110/18/2021
614389-65-1503.2310/18/202110/18/2021
624389-6542389.1410/18/202110/18/2021
634389-653271.3510/18/202110/18/2021
644389-652126.2110/18/202110/18/2021
654389-65-641.5710/18/202110/18/2021
664389-65685.910/18/202110/18/2021
674389-652391.9810/18/202110/18/2021
684389-65-180.3910/18/202110/18/2021
694389-6556436.7410/29/202110/29/2021
704389-65010/18/202110/18/2021
714389-6523919.8410/18/202110/18/2021
724389-6510918.4110/18/202110/18/2021
734389-6542389.1410/18/202110/18/2021
744389-65-2315.0710/18/202110/18/2021
754389-65010/18/202110/18/2021
764389-6565510.510/18/202110/18/2021
774389-65-321.4810/18/202110/18/2021
784389-65010/18/202110/18/2021
794389-654713.6610/18/202110/18/2021
804389-655728.2610/18/202110/18/2021
814389-654713.6610/18/202110/18/2021
824389-651521.8110/18/202110/18/2021
834389-6539280.5210/18/202110/18/2021
844389-6523919.8410/18/202110/18/2021
854389-65-180.3910/18/202110/18/2021
864389-65010/18/202110/18/2021
874389-6562910/29/202110/29/2021
884389-655086.710/18/202110/18/2021
894389-6512681.7910/18/202110/18/2021
904389-65010/18/202110/18/2021
914389-6513421.6910/18/202110/18/2021
924389-655086.710/18/202110/18/2021
934389-655715.8110/18/202110/18/2021
944389-65697.1910/18/202110/18/2021
954389-6523919.8410/18/202110/18/2021
964389-6565510.4910/18/202110/18/2021
974389-657861.2610/18/202110/18/2021
984389-6548041.0210/18/202110/18/2021
994389-652908.6210/18/202110/18/2021
1004389-65-277.8110/18/202110/18/2021
1014389-65010/18/202110/18/2021
1024389-65-277.8110/18/202110/18/2021
1034389-651304.4710/18/202110/18/2021
1044389-653271.3510/18/202110/18/2021
1054389-65-2315.0710/18/202110/18/2021
1064389-652870.3810/18/202110/18/2021
1074389-65697.1910/18/202110/18/2021
1084389-65010/18/202110/18/2021
1094389-6565510.510/18/202110/18/2021
1104389-655086.710/18/202110/18/2021
1114389-6547735.5210/18/202110/18/2021
1124389-65010/18/202110/18/2021
1134389-655764.9210/18/202110/18/2021
1144389-655809.9210/18/202110/18/2021
1154389-65817.1610/18/202110/18/2021
1164389-655086.710/18/202110/18/2021
1174389-651594.6610/18/202110/18/2021
1184389-6584778.2910/18/202110/18/2021
1194389-651610.610/18/202110/18/2021
1204389-6514291.1310/18/202110/18/2021
1214389-653013.4810/18/202110/18/2021
1224389-65869.8310/18/202110/18/2021
1234389-6523919.8410/18/202110/18/2021
1244389-65010/18/202110/18/2021
1254389-65-1503.2310/18/202110/18/2021
1264389-65010/18/202110/18/2021
1274389-652904.9610/18/202110/18/2021
1284389-6565510.4910/18/202110/18/2021
1294389-655086.710/18/202110/18/2021
1304389-65010/18/202110/18/2021
1314389-6513421.6910/18/202110/18/2021
1324389-657248.5710/18/202110/18/2021
1334389-65685.910/18/202110/18/2021
1344389-65392.5610/18/202110/18/2021
1354389-6542389.1410/18/202110/18/2021
1364389-6510987.2710/18/202110/18/2021
1374389-6514291.1310/18/202110/18/2021
1384389-651610.610/18/202110/18/2021
1394389-651073510/18/202110/18/2021
1404389-6542389.1410/18/202110/18/2021
1414389-655308.7410/18/202110/18/2021
1424389-65685.910/18/202110/18/2021
1434389-6523919.8410/18/202110/18/2021
1444389-657248.5710/18/202110/18/2021
1454389-6524238.510/18/202110/18/2021
1464389-65524310/29/202110/29/2021
1474389-65392.5610/18/202110/18/2021
1484389-6521836.8310/18/202110/18/2021
1494389-6520532.9510/29/202110/29/2021
1504389-65697.1910/18/202110/18/2021
1514389-65697.1910/18/202110/18/2021
1524389-657861.2610/18/202110/18/2021
1534389-65010/18/202110/18/2021
1544389-65685.910/18/202110/18/2021
1554389-652463.9510/29/202110/29/2021
1564389-655715.8110/18/202110/18/2021
1574389-6523919.8410/18/202110/18/2021
1584389-651041.4110/18/202110/18/2021
1594389-6519933.210/18/202110/18/2021
1604389-652870.3810/18/202110/18/2021
1614389-65-2679.0210/18/202110/18/2021
1624389-655715.8110/18/202110/18/2021
1634389-6581303.8410/18/202110/18/2021
1644389-6542389.1410/18/202110/18/2021
1654389-6510173.3910/18/202110/18/2021
1664389-655086.710/18/202110/18/2021
1674389-65010/18/202110/18/2021
1684389-652870.3810/18/202110/18/2021
1694389-655715.8110/18/202110/18/2021
1704389-65-4490.9610/18/202110/18/2021
1714389-65-267.910/18/202110/18/2021
1724389-655086.710/18/202110/18/2021
1734389-65-5346.3810/18/202110/18/2021
1744389-6513421.6910/18/202110/18/2021
1754389-652870.3810/18/202110/18/2021
1764389-6542389.1410/18/202110/18/2021
1774389-651310.2110/18/202110/18/2021
1784389-651714.9410/18/202110/18/2021
1794389-651310.2110/18/202110/18/2021
1804389-655715.8110/18/202110/18/2021
1814389-65-2679.0210/18/202110/18/2021
1824389-6513421.6910/18/202110/18/2021
1834389-65010/18/202110/18/2021
1844389-655086.710/18/202110/18/2021
1854389-65431.4110/29/202110/29/2021
1864389-6544239.510/18/202110/18/2021
1874389-655086.710/18/202110/18/2021
1884389-65010/18/202110/18/2021
1894389-6521836.8310/18/202110/18/2021
1904389-6510870.610/18/202110/18/2021
1914389-65010/18/202110/18/2021
1924389-659010/29/202110/29/2021
1934389-6525112.3510/18/202110/18/2021
1944389-651288.210/18/202110/18/2021
1954389-659756.4610/18/202110/18/2021
1964389-655086.710/18/202110/18/2021
1974389-657861.2610/18/202110/18/2021
1984389-652620.4210/18/202110/18/2021
1994389-6542389.1410/18/202110/18/2021
2004389-65-2232.5210/18/202110/18/2021
2014389-652870.3810/18/202110/18/2021
2024389-65-178.610/18/202110/18/2021
2034389-658678.410/18/202110/18/2021
2044389-6510918.4110/18/202110/18/2021
2054389-6542389.1410/18/202110/18/2021
Sheet5


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Month = Table.AddColumn(Source, "Month", each Date.Month([PlannedFinishDate])),
    Group = Table.Group(Month, {"Month"}, {{"Data", each _, type table [ProjectWorkID=text, PlannedAmount=text, PlannedStartDate=datetime, PlannedFinishDate=datetime, Month=number]}}),
    SR = Table.TransformColumns(Group,{{"Data", (tbl)=>
        let
            MD = List.Max(tbl[PlannedFinishDate]),
            Sel = Table.SelectRows(tbl, each _[PlannedFinishDate]=MD)
        in
            Sel
    }}),
    Expand = Table.ExpandTableColumn(SR, "Data", {"ProjectWorkID", "PlannedAmount", "PlannedStartDate", "PlannedFinishDate"}, {"ProjectWorkID", "PlannedAmount", "PlannedStartDate", "PlannedFinishDate"}),
    RC = Table.RemoveColumns(Expand,{"Month"})
in
    RC
Yes so that I can get the latest date for each month for each project

sorry can you explain what you did so I can try it ?
 
Upvote 0

Forum statistics

Threads
1,223,692
Messages
6,173,857
Members
452,535
Latest member
berdex

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