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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Super User
Super User

Mahesh0016_0-1669984864313.png

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.