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

Using IF statement with dates - issues!

I have two dates columns (Request Date and Event Date).  I need to calculate the time between each date, to identify how long clients have waited for their event.  However, in our data, if an event (appt) has not yet been made the default date which is returned is 01/01/2099.  So, when calculating days between, with a 'normal' date field, I get exactly what I need to see.  When I try to calculate days between when the 01/01/2099 is there, I obviously get nonsense days!! 

 

What I need to be able to do is replace all of the instances of 01/01/2099 in the event date column, with today's date (which will obviously change each day with refresh) or leave the event date in place if it's a 'normal date'.  

 

I've tried using IF but the calculated column simply returns 01/01/2099 and therefore doesn't appear to work!?  Any help would be greatly received:

 

Request DateEvent DateDays BetweenEvent Date using TODAY's dateCorrected Days Between
01/11/202201/01/20992782017/11/202216
02/11/202201/01/20992781917/11/202215
03/11/202207/11/2022407/11/20224
04/11/202215/11/20221115/11/202211
05/11/202208/11/2022308/11/20223

 

The final two columns is what I need my data to show!  Many thanks,

1 ACCEPTED SOLUTION
ChrisMendoza
Resident Rockstar
Resident Rockstar

@Creative_tree88 -

add a calculated column as:

Column = 
IF(
    TableName[Event Date] = DATE(2099,1,1)
    ,TODAY() - TableName[Request Date]
    ,TableName[Event Date] - TableName[Request Date]
)

 






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



View solution in original post

3 REPLIES 3

This is a great community forum.  Much appreciated!

ChrisMendoza
Resident Rockstar
Resident Rockstar

@Creative_tree88 -

add a calculated column as:

Column = 
IF(
    TableName[Event Date] = DATE(2099,1,1)
    ,TODAY() - TableName[Request Date]
    ,TableName[Event Date] - TableName[Request Date]
)

 






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Many thanks!  Works like a charm. 

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 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.

Top Solution Authors
Top Kudoed Authors