Forum Discussion

wyanjaspew's avatar
wyanjaspew
Icon for Advocate I rankAdvocate I
3 years ago

filter the dates for last 7 days using powerqueryM

Hi Friends,

I'm trying to filter the dates for last 7 days of data. Thanks

 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Try making "Latest" a step after #"Changed Type",

     

    Latest = List.Max(#"Changed Type[Date Column])

     

    Now you can just refer to the Latest variable and not have to worry about the out of scope table reference. You can still refer to #"Changed Type" as a table, even though your prior step was Latest:

     

    Table.SelectRows(#"Changed Type", each [Date Column] <= Latest and [Date Column] >= Date.AddDays(Latest, -7))

     

    --Nate