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

Next 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

Reply
MrMP
Helper III
Helper III

Week to date and Last year week to date

Hi,

 

In my calendar table, I have indicator if date is WTD. If we take example for today 28th of March, that would be 25-28 March (mon-thu).

How to calculate the same time interval for last year? Since today is Thursday, I would have to go back to Thursday last year and return 20-23 March. and those two calculation should stay on same trend chart.

 

So one line for 4 days in this week and one line for same 4 days in previous year. (yes this cant be achieved with sameperiodlastyear)

 

Thank you!

6 REPLIES 6
PowerBigginer
Helper II
Helper II

WTDLastYear =
VAR CurrentWeekStart = FIRSTDATE(DATESINPERIOD(Calendar[Date], LASTDATE(Calendar[Date]), -1, WEEK))
VAR CurrentWeekEnd = LASTDATE(DATESINPERIOD(Calendar[Date], LASTDATE(Calendar[Date]), -1, WEEK))
RETURN
CALCULATE(
[Measure],
FILTER(
ALL(Calendar),
Calendar[Date] >= CurrentWeekStart &&
Calendar[Date] <= CurrentWeekEnd
)
)

Try this Dax
If it helps please Mark as a solution!

Thank you for solution. WEEK cannot be argument in LASTDATE so this doesnt work.

MNedix
Solution Sage
Solution Sage

I assume you already have a nice Date table, where you have a WeekStartDate and WeekEndDate columns. Based on the WeekStartDate do a calculated column as below:

Week Rank = RANKX(ALL('Date'),'Date'[WeekStartDate],,ASC,Dense)

 

Then, create two measures, one for the current week and another one for last year (assuming that [Measure] is what you want to measure - e.g. Sales, Count etc):

This Week = CALCULATE([Measure], FILTER(ALL('Date'),'Date'[Week Rank]=MAX('Date'[Week Rank])))

Last year same Week = CALCULATE([Measure], FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52)))

 

It should work. If this is the solution you were looking for then pleae mark it as the solution.



If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,

Thank you!

This does not work. It returns good number as total but does not work on a trend. Trend has only WTD dates plotted and has to have same work day last year as trend line.

MNedix
Solution Sage
Solution Sage

Have you tried PARALLELPERIOD ?



If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,

Yep. Doesnt work and cant be plotted on a trend.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.