cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User
Super User

Days Between Dates with Negatives

Have used this one countless times. The problem is that DAYSBETWEEN DAX function does not allow returning negative values, so instead use:

 

DaysBetween = ROUNDUP(1.*[Date]-[OtherDate],0),

I have book! Learn Power BI from Packt


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

Proud to be a Datanaut!

3 REPLIES 3
Highlighted

Re: Days Between Dates with Negatives

Here is an ugly alternative 🙂

 

Column = IFERROR(
DATEDIFF(Dates[Date],Dates[OtherDate],DAY),
-DATEDIFF(Dates[OtherDate],Dates[Date],DAY )
)


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

ElizabethTachji Regular Visitor
Regular Visitor

Re: Days Between Dates with Negatives

Hi,

 

How do you count only work days between two dates?

 

Thanks

Elizabeth Tachjian

elizabeth@analyticsrealtime.com.au

Elizabeth Tachjian
Super User
Super User

Re: Days Between Dates with Negatives

Just add a column to your Date table that will mark a date as a weekday or weekend day and then filter appropriately in your measures.

Best
Darek

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)