cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kartiklal03
Helper I
Helper I

DAX for Calculated Column for Yesterday and Same Day Last Year

Hi All,

 

I need a little help in creating a calculated column for Yesterday and the Same Day Last Year based of a date column in my orders table. 

 

For example, this column should return true if the date in my date column is either 5/26/2021 or 5/26/2020 (based on the current date) and FALSE otherwise. 

 

Thanks in advance!

1 ACCEPTED SOLUTION
selimovd
Community Champion
Community Champion

Hey @Kartiklal03 ,

 

try the following approach:

 

Yesterday or LY =
IF(
    myTable[date] = TODAY()-1 || myTable[date] = DATE ( YEAR ( TODAY() -1 ) - 1, MONTH ( TODAY() -1 ), DAY (  TODAY() -1 ) ),
    TRUE,
    FALSE
)

 

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

2 REPLIES 2
selimovd
Community Champion
Community Champion

Hey @Kartiklal03 ,

 

try the following approach:

 

Yesterday or LY =
IF(
    myTable[date] = TODAY()-1 || myTable[date] = DATE ( YEAR ( TODAY() -1 ) - 1, MONTH ( TODAY() -1 ), DAY (  TODAY() -1 ) ),
    TRUE,
    FALSE
)

 

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

@selimovd , 

 

Thank you. That's perfect and exactly what I was looking for. 

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors