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
JimKeelan
New Member

DAX to Select Rolling 12 Weeks Worked Hours

Hi

 

I am new to DAX and have an issue I'm struggling to resolve.  In the table below you'll see I have 2 measures, HK Week Commencing and Billable Woerked Hours.  I need to be able to display a rolling 12 week position of week commencing and the hours recorded to that week.  So as at today, 11th December 2024 I'd need to display data starting from week commencing 23rd September 2024 to week commencing 9th December 2024.  Many thanks in advance for any help offered.

 

JimKeelan_1-1733910790428.png

 

1 ACCEPTED SOLUTION

Hi @danextian, I managed to solve the solution by adding the week commencing measure into a filter on a matrix and setting the parameters as below.  I managed to figure this out before I saw your reply so haven't tested your suggestion but thank you for your speedy response.

JimKeelan_0-1733998397886.png

 

 

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @JimKeelan 

I dont know exactly how your mode looks like but try this:

rolling 12 weeks =
CALCULATE (
    [sum of billable hours],
    DATESINPERIOD ( 'table'[hk week], 'table'[hk week], -12 * 7, DAY )
)

Result should be similar to below screenshot

danextian_0-1733912789142.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian, I managed to solve the solution by adding the week commencing measure into a filter on a matrix and setting the parameters as below.  I managed to figure this out before I saw your reply so haven't tested your suggestion but thank you for your speedy response.

JimKeelan_0-1733998397886.png

 

 

if you want to show the last 12 weeks and not calculate the value for the last 12 weeks starting from the current row week then that is the approach. Just keep in mind that its reference date changes with each  passing day.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors
Top Kudoed Authors