Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

How to not show dates after previous month

Hello,

I have the following table loaded in Power Query.

NameFromUntilScore
Kacy Jones18/11/202108/12/202149
Kade Kennedy24/11/202116/12/202150
Cristian Thompson20/12/202112/12/202149
Kade Kennedy29/11/202109/12/202149
Damian Mclellan17/12/202129/12/202152
Damian Mclellan20/12/202126/12/202151
Cristian Thompson25/12/202129/12/202152
Ishan Rigby17/12/202129/12/202152
Jimmie Harding19/12/202125/12/202151
Brax Oneill26/12/202131/12/202152
Kacy Jones26/12/202131/12/202152
Bear Barry27/12/202102/01/202252
Jorgie Galloway03/01/202209/01/20221
Farah Lyon07/01/202226/01/20224
Salman Goodman20/12/202110/01/20222
Vincenzo Murray22/12/202111/01/20222
Jorgie Galloway19/12/202109/01/20221
Kade Kennedy06/01/202227/01/20224
Kacy Jones10/01/202216/01/20222
Kacy Jones16/01/202222/01/20223
Kade Kennedy27/01/202216/02/20227
Cristian Thompson23/01/202230/01/20224
Kade Kennedy28/01/202217/02/20227
Damian Mclellan04/02/202216/02/20227
Damian Mclellan31/01/202206/02/20225
Cristian Thompson26/01/202216/02/20227
Ishan Rigby31/01/202221/02/20228
Jimmie Harding31/01/202216/02/20227
Brax Oneill27/01/202215/02/20227
Kacy Jones30/11/202130/11/202148
Bear Barry30/11/202130/11/202148
Jorgie Galloway09/02/202220/02/20227
Farah Lyon16/02/202209/03/202210
Salman Goodman10/02/202227/02/20228
Vincenzo Murray19/02/202210/03/202210
Jorgie Galloway20/02/202225/02/20228
Kade Kennedy21/02/202227/02/20228
Kacy Jones21/02/202214/03/202211
Kacy Jones21/02/202213/03/202210
Kade Kennedy14/02/202220/02/20227
Cristian Thompson04/03/202222/03/202212
Kade Kennedy28/02/202206/03/20229
Damian Mclellan06/03/202212/03/202210
Damian Mclellan09/03/202230/03/202213
Cristian Thompson06/03/202213/03/202210
Ishan Rigby09/03/202230/03/202213
Jimmie Harding14/03/202230/03/202213
Brax Oneill11/03/202216/03/202211
Kacy Jones18/03/202218/03/202211
Bear Barry14/03/202220/03/202211
Jorgie Galloway14/03/202204/04/202214
Farah Lyon09/03/202230/03/202213
Salman Goodman30/11/202130/11/202148
Vincenzo Murray28/03/202208/04/202214
Jorgie Galloway23/03/202230/03/202213
Kade Kennedy17/03/202227/03/202212
Kacy Jones21/03/202225/03/202212
Kacy Jones01/04/202221/04/202216
Kade Kennedy28/03/202215/04/202215
Cristian Thompson30/03/202220/04/202216
Kade Kennedy12/04/202203/05/202218
Damian Mclellan10/04/202216/04/202215
Damian Mclellan18/04/202227/04/202217
Cristian Thompson01/05/202219/05/202220
Salman Goodman10/05/202227/05/202218
Vincenzo Murray09/04/202210/05/202221
Jorgie Galloway20/04/202205/05/202226
Kade Kennedy21/04/202227/05/202249

Here is the M code. The "Month End Date" is based only on the "Until" date column. But i do not know how to add some step/s to retain only the rows for which "Month End Date" which do not occur after the previous month, based on today's date. We are currently in April 2022, so the results should not include any rows with "Month End Date" as from 1 April 2022.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jVfbbhMxEP2VVZ4rxeO9vwbUlpYKCRAvVR9MskpW2gtyQBC+Hnuh8YzHXvMWJ+d4zlyO7Tw/bx7V/pI9zFN33txsoNkCbKWQYBbCLOTromg3LzcWfeiyx26ausPFfCsLhIcK4Uux4N/o/vy9V1P2+TSP387zZEkC4cynZJAWi2o5/q0abYin/dANg7IhoEYoiSmljFCIKklSgXgqZSLOu/PJMD72x6+X/5H10I9j32X3Sh/66WgZGESi/VO10+pX9mHq+mHwdefAA5BuJ9G7Tulsp7Re2oDFC7kVS08kEj/roxF/p4Zh/qksReQIZTrnFn/F3yqtTtn7y1JLUaPfjTS3KBbwJzWMppZ383wYecdAYPZC+NJP+276PWdPP7Re9Eg8bGamfAbPgNQ/kIE3qgLLljXLgZoNS4aKqaFg8juufh70TO3tLV8XdXyYcbdyERBPQzQ4RM1CcIuJAoECojgjxz0SmFHG06jWU6eWJBEkIHQTdiQhBLb3DEn6UDI06bGpuTvoyKJouB+T6IAfWyTA2MdXQ/xIcrPM/JqHCBsS8I6yZrXkhgQsyNL9GDwHIluWLIg/pbCuiR6IGAwFlgMpdM7Fe1KgWK9+aJgFFmFt72LImCld0yqEj12VBASSZxGg4GHISdfyeCYkTqBa1JfJGPyqLBIM6kx7/DtElei1eRghQMPRxJpEihQcHbhoMMV2vXBzGLgrU9Vh3kyeFoHbEqdpHoNMUsCceUKXb4kaF6oOjbdnOIcuE2hz7jrFEi+gilnHbVhifPyyITnaTieCWINdIfZ5VLqhir1l6a5cV4CCm2XL6igrRw1gNS1ayJXzvsRh/GT4TNnBdWIIP+YMUlWDR5RwH8FL/oq3fxde/gA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, From = _t, Until = _t, Score = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"From", type date}, {"Until", type date}, {"Score", Int64.Type}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"From"}),
    Custom1 = Table.AddColumn(#"Removed Columns", "Month End Date", each Date.EndOfMonth([Until])),
    #"Changed Type1" = Table.TransformColumnTypes(Custom1,{{"Month End Date", type date}})
in
    #"Changed Type1"

 

 Any help is much appreciated!

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

Insert this statement after Custom1

 

= Table.SelectRows(Custom1, each ([Month End Date]) < Date.StartOfMonth(Date.From(DateTime.FixedLocalNow())))

 

 

 

View solution in original post

1 REPLY 1
Vijay_A_Verma
Super User
Super User

Insert this statement after Custom1

 

= Table.SelectRows(Custom1, each ([Month End Date]) < Date.StartOfMonth(Date.From(DateTime.FixedLocalNow())))

 

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors