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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

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

 

AjayGajree_0-1676904475683.png

 

Can any help me get this working, much appreciated!

1 ACCEPTED SOLUTION
artemus
Microsoft Employee
Microsoft Employee

Remove the ) after #"Gas Day Executed"

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Well that was a schoolboy error!

 

Thanks a lot!

artemus
Microsoft Employee
Microsoft Employee

Remove the ) after #"Gas Day Executed"

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors