cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Tiago_Varela Regular Visitor
Regular Visitor

weekends last year

Hi all,

 

I'm trying to compare weekends this year with weekends last year.

 

The results i'm getting are that the last year is looking at the day not if it was saturday.

It should be lloking for the 01/05/2019 and compare with 01/06/2018 that was also a saturday.

 

Another thing is that, i want to my weekend be a friday and saturday and not a saturday and sunday, is that possible?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: weekends last year

you could do something like this

LastYearSameWeekDay = 
VAR __WeekNr = MAX('Calendar'[Week])
VAR __WeekDay = MAX('Calendar'[WeekDay])
VAR __Year = YEAR(MAX('Calendar'[Date]))
RETURN
CALCULATE(MAX('Calendar'[Date]), ALL('Calendar'),YEAR('Calendar'[Date])=__Year-1, 'Calendar'[Week]=__WeekNr, 'Calendar'[WeekDay]=__WeekDay)

it gives the date of the same day in the same week of previous year

3 REPLIES 3
Super User
Super User

Re: weekends last year

it seems you need your own calendar table with a custom weekend indicator, and week number
this way you can have custom weekends and compare the weekends with the same index across years (e.g. week 10 of 2018 with week 10 of 2017)

Tiago_Varela Regular Visitor
Regular Visitor

Re: weekends last year

I already have the week number and the weekend/weekdays in my calendar.

How do i compare the same saturday this year with the saturday last year?

Thanks

Super User
Super User

Re: weekends last year

you could do something like this

LastYearSameWeekDay = 
VAR __WeekNr = MAX('Calendar'[Week])
VAR __WeekDay = MAX('Calendar'[WeekDay])
VAR __Year = YEAR(MAX('Calendar'[Date]))
RETURN
CALCULATE(MAX('Calendar'[Date]), ALL('Calendar'),YEAR('Calendar'[Date])=__Year-1, 'Calendar'[Week]=__WeekNr, 'Calendar'[WeekDay]=__WeekDay)

it gives the date of the same day in the same week of previous year