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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
DCWork
New Member

Previous Year Calculation

Morning,

 

I have a calculation to show a date range of the previous Sunday-Saturdy.  Which I am using as a filter.  However I need to take same date range and show it for the previous year.  My Sun-Sat calc is:

 

_Is_Last_Week =
VAR TodayDate = TODAY()
VAR LastSaturday = TodayDate - WEEKDAY(TodayDate, 1)
VAR LastSunday = LastSaturday - 6
RETURN
IF(
'DimDate'[Date] >= LastSunday && 'DimDate'[Date] <= LastSaturday,
TRUE,
FALSE
)

 

Any thoughts on how to amend this for the same period last year?

 

Thanks

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @DCWork  - you can simply shift the calculated LastSunday and LastSaturday back by 1 year using EDATE or DATEADD

 

use the below measure:

_Is_Last_Week_PY =
VAR TodayDate = TODAY()
VAR LastSaturday = TodayDate - WEEKDAY(TodayDate, 1)
VAR LastSunday = LastSaturday - 6

VAR LastSaturday_PY = EDATE(LastSaturday, -12)
VAR LastSunday_PY = EDATE(LastSunday, -12)

RETURN
IF (
'DimDate'[Date] >= LastSunday_PY &&
'DimDate'[Date] <= LastSaturday_PY,
TRUE,
FALSE
)

Hope this helps.





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

Proud to be a Super User!





View solution in original post

2 REPLIES 2
rajendraongole1
Super User
Super User

Hi @DCWork  - you can simply shift the calculated LastSunday and LastSaturday back by 1 year using EDATE or DATEADD

 

use the below measure:

_Is_Last_Week_PY =
VAR TodayDate = TODAY()
VAR LastSaturday = TodayDate - WEEKDAY(TodayDate, 1)
VAR LastSunday = LastSaturday - 6

VAR LastSaturday_PY = EDATE(LastSaturday, -12)
VAR LastSunday_PY = EDATE(LastSunday, -12)

RETURN
IF (
'DimDate'[Date] >= LastSunday_PY &&
'DimDate'[Date] <= LastSaturday_PY,
TRUE,
FALSE
)

Hope this helps.





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

Proud to be a Super User!





that's great, thanks for that.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.