Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Comparing Two Date Column it's return wrong value

i have using below Dax formula

today = IF(VALUE(TODAY()) == test[Request Closed Date] ,"1","0")

yesterday = IF(VALUE(TODAY()-1) == test[Request Closed Date],"1","0")
 
 both condition i have tried but it's return wrong value    can you pls guide me 

 

capture.PNG

1 ACCEPTED SOLUTION

@Anonymous 

 

Yesterday=
IF (
    TODAY ()-1
        = DATE ( YEAR ( testTable[Request Closed Date] ), MONTH ( testTable[Request Closed Date] ), DAY ( testTable[Request Closed Date] ) ),
    1,
    0
)
Today =
IF (
    TODAY ()
        = DATE ( YEAR ( testTable[Request Closed Date] ), MONTH ( testTable[Request Closed Date] ), DAY ( testTable[Request Closed Date] ) ),
    1,
    0
)

 

Is this working?

Also, I have updated my previous post with the sample dataset, see if it is working or not.



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

View solution in original post

7 REPLIES 7
nandukrishnavs
Community Champion
Community Champion

@Anonymous 

 

Try this calculated column

 

Today = IF(TODAY()=testTable[Request Closed Date],1,0)
Yesterday = IF(TODAY()-1=testTable[Request Closed Date],1,0)

 

Also, make sure the Requested Closed Date column type as Date

Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂

Here is my latest blog

https://community.powerbi.com/t5/Community-Blog/Dynamic-Page-Navigation-Based-on-User-Login/ba-p/109...


Regards,
Nandu Krishna

Anonymous
Not applicable

@nandukrishnavs    i have tried but same value i'm getting

 

closed.PNG

Hi @Anonymous ,
 
Apart from the solution mentioned, you can try this too.
 
Yesterday = IF (DATEDIFF(Table[Request Closed Date],Today(),DAY) = 1,1,0)
 
Today= IF (DATEDIFF(Table[Request Closed Date],Today(),DAY) = 0,1,0)
 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

@Anonymous  Make sure the column type is Date.

 

I have tried to replicate your scenario. 

Capture.JPG

Below is the PowerQuery for the sample table

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjLVNTDVNTIwMlCK1QFyTVC5+GWNUblGCG4sAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Request Closed Date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Request Closed Date", type datetime}})
in
    #"Changed Type"

 

Calculated columns

 

Today = IF(TODAY()=testTable[Request Closed Date],1,0)
Yesterday = IF(TODAY()-1=testTable[Request Closed Date],1,0)

 

 Alternatively

Yesterday=
IF (
    TODAY ()-1
        = DATE ( YEAR ( testTable[Request Closed Date] ), MONTH ( testTable[Request Closed Date] ), DAY ( testTable[Request Closed Date] ) ),
    1,
    0
)
Today =
IF (
    TODAY ()
        = DATE ( YEAR ( testTable[Request Closed Date] ), MONTH ( testTable[Request Closed Date] ), DAY ( testTable[Request Closed Date] ) ),
    1,
    0
)

It is working for me.

Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

Anonymous
Not applicable

@nandukrishnavs    yes it's   Date Format   column

 

date.PNG

 

@Anonymous 

 

Yesterday=
IF (
    TODAY ()-1
        = DATE ( YEAR ( testTable[Request Closed Date] ), MONTH ( testTable[Request Closed Date] ), DAY ( testTable[Request Closed Date] ) ),
    1,
    0
)
Today =
IF (
    TODAY ()
        = DATE ( YEAR ( testTable[Request Closed Date] ), MONTH ( testTable[Request Closed Date] ), DAY ( testTable[Request Closed Date] ) ),
    1,
    0
)

 

Is this working?

Also, I have updated my previous post with the sample dataset, see if it is working or not.



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

Anonymous
Not applicable

@nandukrishnavs  Thanks for Sharing it's Working Perfect

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.