Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

Compare text with today()

I have a column called offer_date which has the followig value: Wednesday, 27 January, 2016 .


I am trying to compare this date with today's date in power bi DAX formula. 


 IF(DATEVALUE(offer_date) >= today(), "good job"


The problem is that the comparison is not happening for some reason. Does anyone know how to convert the text date into datetime and compare it with today() ? 

Helper II
Helper II

I was able to convert the initial text date to datetime. So from Wednesday, 27 February, 2017 to 02/27/2017 12:00:00 AM .  I went under the modeling tab and changed the data type from text to datetime. 


The only problem is that the foloowing is still not working: 

IF(DATEVALUE(offer_date) >= today(), "good job", "") 


Note that 02/27/17 is greater than today's date (02/20/17). So, it should be displaying "good job", but it's not. 

Community Champion
Community Champion


This is happening because you have values (more like errors) that cannot be coverted to Date!!!


Blanks would not cause this - but text that cannot be coverted to a date say 4/1/





But I am not getting any such error. 

Hi @kaka,


Please try to click the Refresh button to refresh the data. Also update the desktop to latest version 2.43.4647.541.


You can also create a calculated column to return current date,




Then create a calculated column:


IF(DATEVALUE(offer_date) >= CurrentDate, "good job", "")


If issue persists, would you please share the screenshots about the DAX and results for our analysis? If possible, please share the .pbix file.


Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Community Champion
Community Champion

@kaka  The comparison is actually happening!


You are not seeing anything because you don't have anything in the [ResultIfFalse] part of the IF function


You need to reverse >= to <=




EDIT: I'm assuming this is an Offer Made on Date so you want to it be less than today indicating that Offer has been made! Smiley Happy

Super User
Super User

Go to the data model modeling tab in Power BI Desktop (or in Query Editor) and set the data type to "Date". Then you can do something like this in DAX (slightly different in M code):


Column = IF(DAY([Date]) = DAY(TODAY()) && MONTH([Date]) = MONTH(TODAY()) && YEAR([Date]) = YEAR(TODAY()),"good job","bad job")



@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

What happens when you just create a column with the following code


new column = DATEVALUE('mytable'[offer_date])

secondly, do you round out your IF statement as follows?


new Column2 = if(DATEVALUE('myTable'[offer_Date]>=Today()),"Good Job","")

Oh and are you creating calculated columns as opposed to calculated Measures?

To learn more about DAX visit :

Proud to be a Datanaut!

Helpful resources

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors