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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
dwhittaker1
Helper II
Helper II

calculate Date Diff for positive values only

Is it possible calculate the difference in days between two dates only when the difference is positive? In instances where the difference is negative it should return a 0 . Below would be the expected output.

Create DateRequest DateDate Diff
1/1/20241/9/20248
1/5/20241/10/20245
1/10/20241/11/20241
1/21/20241/12/20240
1 ACCEPTED SOLUTION
vicky_
Super User
Super User

I used the following dax to create a calculated column with your desired results:

Date Diff = 
var diff = DATEDIFF('Table'[Create Date], 'Table'[Request Date], DAY)
return IF(diff < 0 , 0, diff)

 

View solution in original post

1 REPLY 1
vicky_
Super User
Super User

I used the following dax to create a calculated column with your desired results:

Date Diff = 
var diff = DATEDIFF('Table'[Create Date], 'Table'[Request Date], DAY)
return IF(diff < 0 , 0, diff)

 

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.

Top Solution Authors