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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
New to Power Bi and I am looking to create a filter / button(s) that when selected will either filter by 4, 12 or 52 weeks based on the max date in the data set and not today().
Data is in a simple format:
| Date | Value |
| 26 January 2020 | 86018000 |
| 23 February 2020 | 85389000 |
| 22 March 2020 | 99888000 |
| 19 April 2020 | 88414000 |
| 17 May 2020 | 102825000 |
| 14 June 2020 | 106970000 |
| 12 July 2020 | 102965000 |
| 9 August 2020 | 99568000 |
| 6 September 2020 | 96773000 |
| 4 October 2020 | 92743000 |
| 1 November 2020 | 95501000 |
| 29 November 2020 | 97082000 |
| 27 December 2020 | 113130000 |
| 24 January 2021 | 100009000 |
Any ideas welcome!
Solved! Go to Solution.
@Ed_T_Duck , With help from the week Rank and date table. Please refer blog below for more details
Last 4 weeks =
var _max1 = maxx(allselected('order'), 'order'[date])
var _max = maxx(filter(all(date), date[date] = _max1), week[Rank])
return
CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=_max-4 && 'Date'[Week Rank]<=_max))
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8
@Ed_T_Duck , With help from the week Rank and date table. Please refer blog below for more details
Last 4 weeks =
var _max1 = maxx(allselected('order'), 'order'[date])
var _max = maxx(filter(all(date), date[date] = _max1), week[Rank])
return
CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=_max-4 && 'Date'[Week Rank]<=_max))
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8
Thank amitchandak, very helpful!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 39 | |
| 37 | |
| 29 | |
| 24 |
| User | Count |
|---|---|
| 120 | |
| 95 | |
| 70 | |
| 69 | |
| 65 |