cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Stachu Super Contributor
Super Contributor

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

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

Proud to be a Datanaut!

View solution in original post

3 REPLIES 3
Stachu Super Contributor
Super Contributor

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)

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

Proud to be a Datanaut!

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

Stachu Super Contributor
Super Contributor

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

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

Proud to be a Datanaut!

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 48 members 907 guests
Please welcome our newest community members: