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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
dd88
Post Patron
Post Patron

DaysLeft/DATEDIFF to return correct days left/date difff

DaysLeft column uses DATEDIFF forumula

 

DaysLeft = DATEDIFF('Table_INPUTDATA_Ref'[Task DueDate - Copy], TODAY(),DAY)

 

Task DueDate, column Type is Text
Task DueDate - Date, column Type is Date

DueStatus column, has conditions and is displaying incorrectly.


I noticed DaysLeft returned values that are 'reversed' ie positive days 8914 are suppose to be negative -8914. The negative days -96 are supposed to be positive ie 96

The result is, the column DueStatusdisplays DueStatus incorrectly.

 

DateDiffFormula.png

 

 

How can DaysLeft/DateDiff  return an accurate values

 

TIA

1 ACCEPTED SOLUTION
Irwan
Super User
Super User

Hello @dd88 

 

I assumed 1/09/2024 means 1 September 2024.

Looking at your DAX, start date is 1/9/2024 and end date is TODAY(), the value will be negative because end date is less than start date.

 

Try switching the DAX.

DaysLeft = DATEDIFF(TODAY(),'Table_INPUTDATA_Ref'[Task DueDate - Copy],DAY)

Irwan_1-1716875150014.png

 

Hope this will help you.

Thank you.

View solution in original post

2 REPLIES 2
dd88
Post Patron
Post Patron

many thanks @Irwan  thats great ..   

Irwan
Super User
Super User

Hello @dd88 

 

I assumed 1/09/2024 means 1 September 2024.

Looking at your DAX, start date is 1/9/2024 and end date is TODAY(), the value will be negative because end date is less than start date.

 

Try switching the DAX.

DaysLeft = DATEDIFF(TODAY(),'Table_INPUTDATA_Ref'[Task DueDate - Copy],DAY)

Irwan_1-1716875150014.png

 

Hope this will help you.

Thank you.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.