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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Tiago_Varela
Helper I
Helper I

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

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



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

3 REPLIES 3
Stachu
Community Champion
Community Champion

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)



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

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

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



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.