Last Sunday of the Month

Hi,

I am looking to identify the last Sunday of a month for example March.

The goal is to be able to have a measure that will work out when the hour goes forward or backwards in the UK without the need to hardcode the DAX which would require ongoing maintenance.

I don’t have a PBIX to share but if anybody has assistance on the DAX it will be appreciated.

Thanks,

James

Hi @JamesDavies,

Give this a go

Last Sunday in March =
VAR d = DATE( YEAR(TODAY()), 3, 1)
VAR r = EOMONTH( d, 0) - MOD( WEEKDAY(EOMONTH( d, 0), 11), 7)
RETURN r
2 Likes

Spot on, thank you. I did find an alternative method but this seems to do the job much cleaner.

Thank you!

@JamesDavies
Please try this as a calculated column

Last Sunday  =
  VAR __Date = 'Calendar'[Date]
  VAR __Weeknum = WEEKNUM(__Date)
  VAR __PreviousWeekNum = __Weeknum - 1
RETURN
  MAXX(FILTER('Calendar',WEEKNUM([Date]) = __PreviousWeekNum && WEEKDAY([Date]) = 1),[Date])