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
MiguelSaldana77
Resolver I
Resolver I

last day February on leap year.

Hi everybody, I have a problem Calculating February last day on leap year.
Suppose we are on February 15, 2017 and I need to calculate the last day of the same date one year back (February 29,2016) (It’s a Leap year).
Any idea?

1 ACCEPTED SOLUTION
MiguelSaldana77
Resolver I
Resolver I

I finally made this way

image.jpg

 

View solution in original post

5 REPLIES 5
MiguelSaldana77
Resolver I
Resolver I

I finally made this way

image.jpg

 
amitchandak
Super User
Super User

@MiguelSaldana77 ,

If it is a continuous date

the dateadd(Table[Date],-1,year)

 

Or

Last year same date = date(year(Table[Date])-1,month(Table[Date]),day(Table[Date]))

az38
Community Champion
Community Champion

@MiguelSaldana77 

if you need last day of the same month, but in a previous year try

Column = ENDOFMONTH( DATE(YEAR([Date]) - 1, MONTH([Date]), DAY([Date])) )

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

The Problem is because the dashboard has 2 filters (Year  and Month )  and In order to get the date I´m using MAX(Time(Date))  and the "ENDOFMONTH"  not accept Max as a part of the formula.
Error=    

ENDOFMONTH( DATE( VALUE(YEAR(MAX('Cat Tiempo'[Fecha])))- 1, MONTH(Max('Cat Tiempo'[Fecha])), DAY(Max('Cat Tiempo'[Fecha]))) )

@MiguelSaldana77 - EOMONTH(MAX('Cat Tiempo'[Fecha]),-12) For last year February. For this year Feb, EOMONTH(MAX('Cat Tiempo'[Fecha]),0) assuming your max date is some date in Feb.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.