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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Dynamic 13 weeks based on WEEK SELECTION [DD-MM-YY]

Hi Power BI Community

 

I'm trying to create a dynamic 13 weeks selection based on week DD-MM-YY which should dynamically populate 13 weeks data instead of individual selection.


I check the earlier solved DAX query which is mostly based on 13-weeks selection. https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La.... Thanks [@AmitChandak]

 

Currently, I'm using this DAX which is partially doing the job, where I've to select the whole 13 weeks to achieve the desired output, instead, I need one single selection and it should populate the previous 13 weeks data before that without selecting prior 13 week value in the slicer.


In my use case, I'm using Line and Clustered Column Chart that should dynamically change e.g. when I select Week Commencing e.g. 13-12-2020 (Please note I'm using DD-MM-YY not Week number), it should pull data from 13-12-2020 to 20-09-2020 or if I select 20-12-2020 the data range should be till 27-09-2020 so that I can see how my last 13 sales are doing. 

 

As shown in sample datasets and Line https://drive.google.com/file/d/1xk1xlvWiFcGTUH_8X_1R5OwwARVm11NP/view?usp=sharing and Clustered Columncharts. I've attached sample data, DATE table, and DAX measure formula

 

Please help.

 

Many Thanks

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , If need rolling 13 weeks

Rolling 13 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-13*7,Day))

 

Rolling 13 till last 13 month = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max(dateadd('Date'[Date],-13*7,Day)),-13*7,Day))

 

Last 13 weeks = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])-13 && 'Date'[Week Rank]<=max('Date'[Week Rank])))

 

Last 13 weeks before 13 = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])-26 && 'Date'[Week Rank]<=max('Date'[Week Rank]) -13 ))

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.