Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All
How can I filter my query for the last 7 days of data, so not from the current days but simply the last 7 days that is in the data?
Hope that makes sense!
Thanks in advance!
Solved! Go to Solution.
@Anonymous
You need to add a new step as follows:
Click on the Fx button on the last step
Past this code and modify the #"Changed Type" to your previous step,
= Table.SelectRows(#"Changed Type", let latest = List.Max(#"Changed Type"[Date]) in each ([Date] <= latest) and ([Date] >= Date.AddDays(latest,- 7) ))
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
In case the dates are not consecutive, you can use this approach. Add any filter step on your Date column and then modify it in the formula bar as below. Replace Previous Step with your actual previous step.
= Table.SelectRows(#"Previous Step", each [Date] >= List.Sort(List.Distinct(#"Previous Step"[Date]), Order.Descending){6})
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@Anonymous
You need to add a new step as follows:
Click on the Fx button on the last step
Past this code and modify the #"Changed Type" to your previous step,
= Table.SelectRows(#"Changed Type", let latest = List.Max(#"Changed Type"[Date]) in each ([Date] <= latest) and ([Date] >= Date.AddDays(latest,- 7) ))
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Thank you very much!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.