cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
p1nkman
Helper I
Helper I

Filter only first and last date of month from a table

Hey guys,

 

As the title suggests, I have a big set of data ranging from the last 2 years until today for everyday. I need to filter out only the first and last date of each month of these dates from last two years to reflect on my report. What would be the best way to achieve this? 

 

Thank you and kind regards

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @p1nkman 

 

If you want to keep only the first and last date of each month in your data table, you can use Power Query Editor to filter the rows. Insert a step after the last step and paste below M code into the formula bar. Replace "previous step name" with the last step's name. 

= Table.SelectRows(#"previous step name", each [Date] = Date.StartOfMonth([Date]) or [Date] = Date.EndOfMonth([Date]))

vjingzhang_0-1670232991635.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
 

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @p1nkman 

 

If you want to keep only the first and last date of each month in your data table, you can use Power Query Editor to filter the rows. Insert a step after the last step and paste below M code into the formula bar. Replace "previous step name" with the last step's name. 

= Table.SelectRows(#"previous step name", each [Date] = Date.StartOfMonth([Date]) or [Date] = Date.EndOfMonth([Date]))

vjingzhang_0-1670232991635.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
 

Mahesh0016
Solution Sage
Solution Sage

Mahesh0016_0-1669984864313.png

Lastday = ENDOFMONTH('DATE'[Date])
 
Hello @p1nkman ,
i think it is helpful for you.

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.