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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Filter date until this month

Hi,

 

I have Leave Data from dynamics.

So I have 2 types of leave, 1 is Leave Credit, and 1 is Annual Leave.

the Leave Credit data is already loaded until the end of the year. Example:

we have 2016 and 2017 data, for 2016 we just put it as leftover in the first January.

For Now I put the filter (in edit queries) date is in year this year or leave type not equals leave credit.

So if it's not November yet the data for Leave credit only shown until October.

 

But if the years in 2018, in month March, the leave credit only will be shown at March 2017 - March 2018.

There will be no data for January, and February 2017. What I need is the filter all the data until this month.

But using filter in Edit Query because I already create some calculation there.

 

I hope you can understand my question and example.

 

Thanks,

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Already found the answer!

 

= Table.SelectRows(#"Name of Previous Step", each [pafo_EstimatedEndDate] <= DateTime.LocalNow())

 Just want to share if someone needs it 🙂

 

Thanks!

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Up, hoping someone can help

Anonymous
Not applicable

Already found the answer!

 

= Table.SelectRows(#"Name of Previous Step", each [pafo_EstimatedEndDate] <= DateTime.LocalNow())

 Just want to share if someone needs it 🙂

 

Thanks!

Anonymous
Not applicable

Hi conniedevina,

could you please share the workbook 🙂

Thank you in advance!

 

Best Regards,

Anastasiia Lagunova

Anonymous
Not applicable

Hi @Anonymous,

 

Please check this link for the workbook and data source (Excel).

 

Thanks,
Regards,
Connie

v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may select "Custom Filter..." and do research into The Advanced Editor.

    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each Date.IsInPreviousNMonths([Date], 12) or Date.IsInCurrentMonth([Date]))
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

but if you use

Date.IsInPreviousNMonths([Date], 12) 

 It will be only take data for last year right?

 

Example the data already from January 2017 - March 2018.

Today month is February 2018, it will only take data from February 2017 - February 2018 right?

What I need is the data from January 2017 - February 2018 (if the example today is february).

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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 Solution Authors