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
AhmedHassan
Frequent Visitor

Hello All , Kindly i need to have yesterday date last year

Hello All , Kindly i need to have yesterday date for last year based on slected month from Dim_Date slicer
So as an example

if i chosed May 2023 yesterday will be 2022-06-05

if i chosed April 2023 yesterday will be 2022-04-05

 

AhmedHassan_0-1686045792664.png

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @AhmedHassan 
Please try

Yesterday Date =
VAR SelectedDate =
    MAX ( Dim_Date[Date] )
VAR TodayDate =
    TODAY ()
RETURN
    DATE ( YEAR ( SelectedDate ) - 1, MONTH ( SelectedDate ), DAY ( TodayDate ) - 1 )

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @AhmedHassan 
Please try

Yesterday Date =
VAR SelectedDate =
    MAX ( Dim_Date[Date] )
VAR TodayDate =
    TODAY ()
RETURN
    DATE ( YEAR ( SelectedDate ) - 1, MONTH ( SelectedDate ), DAY ( TodayDate ) - 1 )

Hello @tamerj1 
you saved my day , cannot thank you enough. many thanks and much appreciated

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.

Top Solution Authors