Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Last 7 Days Data Based on a Parameter

 

= Table.SelectRows(#"Set Data Types", let latest = List.Max(#"Set Data Types"[Gas Day]) in each ([Gas Day] <= latest) and ([Gas Day] >= Date.AddDays(latest,- 7) ))

 

 

Hi All

 

I found the above code to filter my date field in Power Query for the last 7 days in my data

 

What I would like to do is change that to the last 7 days from the date set in a Parameter

 

I have got as far as creating a Parameter called Gas Day Executed On and placed it in my code below

 

 

= Table.SelectRows(#"Set Data Types", let latest = #"Gas Day Executed") in each ([Gas Day] <= latest) and ([Gas Day] >= Date.AddDays(latest,- 7) ))

 

 

This gives me an error

 

 

Can any help me get this working, much appreciated!

2 Replies

  • artemus's avatar
    artemus
    Microsoft Employee

    Remove the ) after #"Gas Day Executed"

  • Anonymous's avatar
    Anonymous
    Not applicable

    Well that was a schoolboy error!

     

    Thanks a lot!