Forum Discussion

HenriG's avatar
HenriG
Copper Contributor
Feb 01, 2022
Solved

Looking to restrict power query to last 100 days

Hello, I'm attempting to use excel to restrict the data from my database to the last 100 days.  Currently the query restricts to a "is greater than date" format which works but the file becomes very ...
  • Lorenzo's avatar
    Feb 01, 2022

    Hi HenriG 

     

    If your version of Excel/PQ doesn't have function https://docs.microsoft.com/en-us/powerquery-m/date-isinpreviousndays you can get the same result using the following approach, assuming the column to filter is called [Date] (update #"Previous Step Name" below):

    = Table.SelectRows(#"Previous Step Name", each
        DateTime.Date([Date]) >= DateTime.Date(Date.AddDays(DateTime.FixedLocalNow(), -100))
    )

     

Resources