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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bhmiller89
Helper V
Helper V

DATEDIFF

I keep getting errors with Date Diff.  I need to find hours difference between Open Date and Resolved Date.

 

Each item does not have a Resolve Date, so I tried

 

"Resolution Time= IF('table'[Resolved Date] <> BLANK(), DATEDIFF('table'[Open Date], 'table'[Resolved Date], HOUR), 0)"

 

But still get errors.

1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

@bhmiller89 Try this formula as a column...

 

Resolution Time Column = 
IF (
    ISBLANK ( 'Table'[Resolved Date] ),
    0,
    IF (
        'Table'[Resolved Date] < 'Table'[Open Date],
        -1 * DATEDIFF ( 'Table'[Resolved Date], 'Table'[Open Date], HOUR ),
        DATEDIFF ( 'Table'[Open Date], 'Table'[Resolved Date], HOUR )
    )
)

If this works you have some resolved dates that are prior to their respective open date.

Those will appear as negative numbers in the resolution column because of the * -1.

Hope this resolves the errors! Smiley Happy

 

Datediff - 2016-09-06.png

View solution in original post

1 REPLY 1
Sean
Community Champion
Community Champion

@bhmiller89 Try this formula as a column...

 

Resolution Time Column = 
IF (
    ISBLANK ( 'Table'[Resolved Date] ),
    0,
    IF (
        'Table'[Resolved Date] < 'Table'[Open Date],
        -1 * DATEDIFF ( 'Table'[Resolved Date], 'Table'[Open Date], HOUR ),
        DATEDIFF ( 'Table'[Open Date], 'Table'[Resolved Date], HOUR )
    )
)

If this works you have some resolved dates that are prior to their respective open date.

Those will appear as negative numbers in the resolution column because of the * -1.

Hope this resolves the errors! Smiley Happy

 

Datediff - 2016-09-06.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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