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
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
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.

Top Solution Authors