Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I support a team monitoring weekly captured data from a 5 week window. Each row of my set has a specific date - thousands of rows of data fitting into 5 weeks, and my report needs to dynamically compare each week's data with the others. I'm working to prep DAX to assign number 1-5 to each of the weeks as the project rolls on.
So currently: Dec 22 = 1, Dec 29 = 2, Jan 5 =3, Jan 12 = 4, Jan 19 = 5.
Next week: Dec 29 = 1, Jan 5 = 2, Jan 12 = 3, Jan 19 = 4, Jan 26 = 5 and so on..
First time in the forums so please let me know if I need to provide additional context.
Solved! Go to Solution.
1) Create a WeekStart column in your Date table (Monday-start example):
WeekStart =
'Date'[Date] - WEEKDAY('Date'[Date], 2) + 1
2) Then create a RollingWeekIndex (1–5) measure (or calculated column if you truly need it stored):
RollingWeekIndex =
VAR CurrentWeekStart =
MAX ( 'Date'[WeekStart] )
VAR LatestWeekStart =
CALCULATE ( MAX ( 'Date'[WeekStart] ), ALL ( 'Date' ) )
VAR DiffWeeks =
DATEDIFF ( CurrentWeekStart, LatestWeekStart, WEEK )
RETURN
IF ( DiffWeeks >= 0 && DiffWeeks <= 4, 5 - DiffWeeks )
hi @zedsdead ,
Not sure if i fully get you, try to write a calculated column like:
Column =
VAR _DateCurrent = TODAY()
// VAR _DateCurrent = DATE(2026, 2, 9)
VAR _MondayCurrent = _DateCurrent - WEEKDAY(_DateCurrent, 3)
VAR _WeekShift = DATEDIFF(DATE(2025,12,22), TODAY(), WEEK)
VAR _result = _WeekShift - DATEDIFF([date], _MondayCurrent, WEEK) +1
RETURN _result
it works like below:
you may comment line 2 and uncomment line 3 to try future dates, like next week:
Hello @zedsdead,
Hope everything’s going great with you. Just checking in has the issue been resolved or are you still running into problems? Sharing an update can really help others facing the same thing.
Thank you.
Hello @zedsdead,
Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to @FreemanZ, @cengizhanarslan & @Zanqueta for sharing valuable insights.
Could you please confirm if your query has been resolved by the provided solutions? This would be helpful for other members who may encounter similar issues.
Thank you for being part of the Microsoft Fabric Community.
thank you team for all of the responses! I'm still working through the solution and will mark as resolved asap.
hi @zedsdead ,
Not sure if i fully get you, try to write a calculated column like:
Column =
VAR _DateCurrent = TODAY()
// VAR _DateCurrent = DATE(2026, 2, 9)
VAR _MondayCurrent = _DateCurrent - WEEKDAY(_DateCurrent, 3)
VAR _WeekShift = DATEDIFF(DATE(2025,12,22), TODAY(), WEEK)
VAR _result = _WeekShift - DATEDIFF([date], _MondayCurrent, WEEK) +1
RETURN _result
it works like below:
you may comment line 2 and uncomment line 3 to try future dates, like next week:
1) Create a WeekStart column in your Date table (Monday-start example):
WeekStart =
'Date'[Date] - WEEKDAY('Date'[Date], 2) + 1
2) Then create a RollingWeekIndex (1–5) measure (or calculated column if you truly need it stored):
RollingWeekIndex =
VAR CurrentWeekStart =
MAX ( 'Date'[WeekStart] )
VAR LatestWeekStart =
CALCULATE ( MAX ( 'Date'[WeekStart] ), ALL ( 'Date' ) )
VAR DiffWeeks =
DATEDIFF ( CurrentWeekStart, LatestWeekStart, WEEK )
RETURN
IF ( DiffWeeks >= 0 && DiffWeeks <= 4, 5 - DiffWeeks )
Hi @zedsdead,
I am not entirely certain, but for this type of dynamic comparison between weeks, what usually works very well is to create a “Week Index” logic that adjusts itself automatically as the calendar moves forward.
From your description, your requirements are:
You always work with a 5‑week rolling window.
Each of those 5 weeks must be assigned a label from 1 to 5, where:
1 = oldest week in the current 5‑week window
5 = most recent week in the current 5‑week window
When a new week is added, every existing week “shifts” its index.
That´s it ?
My suggestion is to create a measure that calculates, for each week, which index (1–5) it should have based on the most recent week present in the data.
If this response was helpful in any way, I’d gladly accept a kudo.
Please mark it as the correct solution. It helps other community members find their way faster.
Connect with me on LinkedIn
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 12 | |
| 9 | |
| 5 | |
| 5 |