Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 5 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 20 | |
| 14 | |
| 11 | |
| 9 | |
| 8 |