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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Truecharv
New Member

Date Calculation between three dates

My data set has a creation date, reopend date, and closed date column. Not all lines have a reopen date. I am trying to create a column that will calculate the age based on the reopend date if it has a value, but the creation date in all other cases. Any help is appreciated.

1 ACCEPTED SOLUTION

This formula did not quite work but it was a great help to start testing. I was able to get the code to work with the following:

 

Age =

IF( 

[Reopen] <> BLANK (),

[Closed date]-[Reopen date],

[Closed date]-[created date])

View solution in original post

4 REPLIES 4
FreemanZ
Super User
Super User

hi @Truecharv 

In addition to the measure proposed by Nathaniel, you may also create a column like this:

Age =
IF(
    [reopen date] <> BLANK(),
    DATEDIFF([closed date], [creation date]), DAY),
    DATEDIFF([reopen date], [creation date], DAY)
)

the result is in days, you may change DAY to other unit if necessary, like YEAR.

This formula did not quite work but it was a great help to start testing. I was able to get the code to work with the following:

 

Age =

IF( 

[Reopen] <> BLANK (),

[Closed date]-[Reopen date],

[Closed date]-[created date])

Nathaniel_C
Community Champion
Community Champion

Hi @Truecharv ,

If you wish a measure, try this:

Duration =
IF (
    ISBLANK ( MAX ( dtaTable[Reopen Date] ) ),
    DATEDIFF ( MAX ( dtaTable[Creation Date] ), MAX ( dtaTable[Closed Date] ), DAY ),
    DATEDIFF ( MAX ( dtaTable[Reopen Date] ), MAX ( dtaTable[Closed Date] ), DAY )
)

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @Truecharv ,
Here is what my table looks like:

Nathaniel_C_0-1673479912051.png


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.