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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
JRHans09
Resolver II
Resolver II

Date is in the next 30 days

I am trying to filter the date range in PowerQuery to show the dates in the next 30 days, including today. Date field is called: dd-date

 

I have tried:

 

 

Table.SelectRows(#"Filtered rows 1", each [#"dd-date"] >= DateTime.LocalNow() and [#"dd-date"] <= ( DateTime.LocalNow() + 30))

 

Error message:  something about not possible to use '>' in date functions
 

 

Table.SelectRows(#"Filtered rows 1", Date.IsInNextNDays(Date.AddDays(DateTime.FixedLocalNow(), 1), 30)​

 

Error message: We cannot convert the value true to type Function.
 
How do I filter the date range to be in the next 30 days (including today)?
 
Sorry, I am sure there is a simple solution to this, but I am very inexperienced in M.
 
Thanks for you help.
1 ACCEPTED SOLUTION

Please try this expression instead, confirming the name of your previous step and your date column name.  Just replace the line you showed with this in the Formula Bar.  You can auto generate this line by using the pull-down filter on your date column, choose Date Filters, and "In the Next".

 

= Table.SelectRows("Filtered Rows 1", each Date.IsInNextNDays([dd-date], 30))

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
JRHans09
Resolver II
Resolver II

I just tried this and receive a Timeout error:

Table.SelectRows(#"Filtered rows 1", each [#"dd-date"] = Date.IsInNextNDays(Date.AddDays(DateTime.FixedLocalNow(), 1), 14))
Reduced to 14 days to see if the data would load.
 
Thanks.

Please try this expression instead, confirming the name of your previous step and your date column name.  Just replace the line you showed with this in the Formula Bar.  You can auto generate this line by using the pull-down filter on your date column, choose Date Filters, and "In the Next".

 

= Table.SelectRows("Filtered Rows 1", each Date.IsInNextNDays([dd-date], 30))

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


No code errors now, but continue to receive a timeout error.

 

Thanks for your help.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.