Forum Discussion
mandar
3 years agoFrequent Visitor
Last 'x' days use as parameter for data refresh in PBI Dataset
Hi, I have a scenario where I need to create a dynamic parameter based on which I should be able to update the data refresh. For eg; if I want only the last 90 days data then I should be able...
- 3 years ago
You forgot to place - before your parameter. That adds instead of deducting days.
danextian
Super User
3 years agoHi mandar ,
You can use Date.From (DateTime.LocalNow()) to get the current date or server date if refreshed via service. Then Date.AddDays to get the date from a certain date less x number of days. Below is an example of how to dynamically filter a date colum in PQ
= Table.SelectRows(#"Name of Previous Step", each [Date] >= Date.AddDays ( Date.From ( DateTime.LocalNow() ), -LastXDays+1 ) )
Change LastXDays to the actual parameter name which type is Decimal Number.