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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.