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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Custom Date filter in Advanced Editor

I need a custom date filter that includes anything from the past 60 days.  I don't see in "Filtered Columns" that this is an option.  I have put a custom SQL statement into the Advanced Editor, but I am getting timeout errors when I apply changes or refresh the data.  

So, is there a way to edit the statement below to reflect > 60 days ago instead of > a specific date?

 

[destination_earliest_arrival] >= #datetime(2018, 11, 1, 0, 0, 0)

3 REPLIES 3
Anonymous
Not applicable

Have you tried with the Date.IsInPreviousNDays M function? /sample code/ #"Filtered Rows" = Table.SelectRows(#"Changed Type", each Date.IsInPreviousNDays([Date], 60))
Anonymous
Not applicable

Thanks, @Anonymous.  I will give that a shot.  I did not know the proper syntax to make the change.  I tried something similar to the SQL code, but that was not correct.

Hi @Anonymous,

 

For your scenario, you could consider to use query parameter to get the data from past 60 days.

 

With the Query Parameters, we can define one or multiple parameters to be used in the queries, Data Model and report layers in Power BI Desktop.

 

For example, to pass the date parameters in PQ Query, you can create a new Query Parameter of Date, then use this date parameter to filter your corresponding date column in the Query. For more details about POWER BI DESKTOP QUERY PARAMETERS, you can refer to this article. 

 

"Startdate" and "Enddate" are two parameters.

let
    Source = Sql.Databases(""),
    AdventureWorksDW2012 = Source{[Name="AdventureWorksDW2012"]}[Data],
    dbo_DimDate = AdventureWorksDW2012{[Schema="dbo",Item="DimDate"]}[Data],
    #"Filtered Rows" = Table.SelectRows(dbo_DimDate, each [FullDateAlternateKey] >=Startdate and each [FullDateAlternateKey] <= Enddate )
in
    #"Filtered Rows"

 

In addition, if it is convenient, could you share some data sample and your desired output so that we could help further on it.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.