cancel
Showing results for
Did you mean:
Highlighted
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 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

Proud to be a Datanaut!

3 REPLIES 3
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)

Proud to be a Datanaut!

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 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

Proud to be a Datanaut!

Announcements

#### Challenge: Can You Solve These?

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

#### Community News & Announcements

Get your latest community news and announcements.

#### 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.

#### Win Power BI Swag with Community Kudopalooza!

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

Top Kudoed Authors
Users Online
Currently online: 312 members 3,175 guests
Recent signins: